Results 1 to 3 of 3

Thread: Hiding paging toolbar of combobox works no more in Ext 4.1

  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    4
    Vote Rating
    1
      0  

    Default Hiding paging toolbar of combobox works no more in Ext 4.1

    Hi,

    I want to hide the paging toolbar of a picker (of a combobox) if only one site is in the store.

    I wrote this Code with Ext 4.0.2 to hide the paging toolbar if only on page is visible:
    Code:
    listeners:{
                    expand:Ext.bind(function (comboBox) {
                        var picker = comboBox.getPicker();
                        if (comboBox.store.getTotalCount() > this.pageSize) {
                            // show the paging toolbar completely
                            picker.minWidth = 250;
                            // show paging
                            picker.pagingToolbar.show();
                            // this is a workaround for a bug with the paging toolbar. After updating one comboBox
                             
                            picker.pagingToolbar.doLayout();
                        } else {
                            // set to ext default
                            picker.minWidth = 70;
                            // and hide paging toolbar
                            picker.pagingToolbar.hide();
                        }
                    }, this)
                },
    but this don't work anymore in Ext 4.1! Now I have to click 3 times on the trigger to get the picker shown. On the first click it has the position -9999, -9999 .... Has anyone an idea how to achieve the same goal with more robust code in Ext 4.1?

    Here is my complete combobox:
    Code:
    comboBox = Ext.create('Ext.form.field.ComboBox', {
                displayField:"name",
                valueField:"value",
                emptyText:emptyText,
                store:store,
                queryParam:"searchTerm",
                hiddenName:dimensionId,
                dimensionId:dimensionId,
                listConfig:{
                    loadingHeight:300
                },
                listeners:{
                    expand:Ext.bind(function (comboBox) {
                        var picker = comboBox.getPicker();
                        if (comboBox.store.getTotalCount() > this.pageSize) {
                            // show the paging toolbar completely
                            picker.minWidth = 250;
                            // show paging
                            picker.pagingToolbar.show();
                            // this is a workaround for a bug with the paging toolbar. After updating one combobox
                            picker.pagingToolbar.doLayout();
                        } else {
                            // set to ext default
                            picker.minWidth = 70;
                            // and hide paging toolbar
                            picker.pagingToolbar.hide();
                        }
    
    
                    }, this)
                },
                disabled:true,
                cls:'filter-selectbox combobox',
                forceSelection:true,
                typeAhead:true,
                minChars:0,
                pageSize:this.pageSize,
                anchor:'100%'
            });

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    Without that listener do you have to still click many times to get the picker? Also is the store already loaded when you try to expand?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    4
    Vote Rating
    1
      0  

    Default

    Quote Originally Posted by mitchellsimoens View Post
    Without that listener do you have to still click many times to get the picker? Also is the store already loaded when you try to expand?
    Yes and yes. Without that listener it works as expected, one click opens the picker. The store is already loaded when I try to expand it. I load the store with this 2 lines:
    Code:
    comboBox.lastQuery = ""; // set this so comboBox don't load again on first click
    comboBox.store.load(Ext.bind(this.onComboBoxValuesLoaded, this, [comboBox, false], false));

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •