PDA

View Full Version : Hiding paging toolbar of combobox works no more in Ext 4.1



vollekannehoschi
5 Jun 2012, 7:49 AM
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:


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:


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%'
});

mitchellsimoens
7 Jun 2012, 1:34 PM
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?

vollekannehoschi
8 Jun 2012, 12:13 AM
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:


comboBox.lastQuery = ""; // set this so comboBox don't load again on first click
comboBox.store.load(Ext.bind(this.onComboBoxValuesLoaded, this, [comboBox, false], false));