-
25 Jan 2012 2:57 AM #1
comboBox with loadRawData
comboBox with loadRawData
Hi,
On ExtJs 4.1b1, I've an issue when I use loadRawData on a store binded by a ComboBox. After calling loadRawData, if click on a list item nothing append.
My class :
So I create an instance of my component with an initial value, after that I can't select other element from list.Code:Ext.define('Ext.ux.adminext.admimail.partner.form.CountryCityAssocPostalCodeField', { extend : 'Ext.form.field.ComboBox', alias : 'widget.ux-admimail-partner-countrycityassocpostalcodefield', selectOnFocus : true, filterConfig : { "property" : "nameOrPostalCode", "comparator" : "likes" }, initComponent : function() { var store = DR.getStore('countryCityAssocPostalCode', { autoDestroy : true, pageSize : 10 }); Ext.apply(this, { typeAhead : false, hideTrigger : true, minChars : 1, forceSelection : true, listConfig : { itemTpl : '{resume}', emptyText : "Aucune ville trouvée" }, valueField : 'id', displayField : 'city', store : store, pageSize : store.pageSize, queryParam : 'filters' }); this.on('beforequery', function(o, eOpts) { o.query = Ext.JSON.encode([Ext.apply({ "value" : o.query }, this.filterConfig)]); }, this); if (this.value) { this.on('afterrender', Ext.pass(this.setJsonValue, [this.value]), this, { single : true }); delete this.value; } this.callParent(arguments); }, setJsonValue : function(value) { this.store.loadRawData({ success : true, data : { total : 0, records : [value] } }); var record = this.store.getAt(0); this.setValue(record.get(this.valueField)); this.fireEvent('select', this, [record]); } });
I think error is in combobox store binding or loadRawData method:
ComboBox expect that 'beforeload' event should be fired before 'load', but #loadRawData fire only the 'load' event ... which cause a truthy value for #ignoreSelectionCode:Ext.define('Ext.form.field.ComboBox', { .... getStoreListeners: function() { return { beforeload: this.onBeforeLoad, load: this.onLoad, exception: this.onException }; }, onBeforeLoad: function(){ ++this.ignoreSelection; }, onLoad: function() { var me = this, value = me.value; --me.ignoreSelection; ..... } }); Ext.define('Ext.data.Store', { ..... loadRawData : function(data, append) { var me = this, result = me.proxy.reader.read(data), records = result.records; if (result.success) { me.totalCount = result.total; me.loadRecords(records, { addRecords: append }); me.fireEvent('load', me, records, true); } } });
Regards,
PHaroZ
-
7 Feb 2012 8:45 AM #2
I have the same issue. Any fix or workaround found?
Thanks
-
6 Apr 2012 12:09 AM #3
With RC2
I've another bug, see http://www.sencha.com/forum/showthre...pageSize+combo
So I apply the workaround in #5
I don't know if it's linked to my previous error/workaround but this issue seems finally to be fixed.
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote