Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext JS Premium Member
    Join Date
    Dec 2007
    Posts
    38
    Vote Rating
    0
    PHaroZ is on a distinguished road

      0  

    Default 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 :
    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]);
                }
    
            });
    So I create an instance of my component with an initial value, after that I can't select other element from list.

    I think error is in combobox store binding or loadRawData method:
    Code:
    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);
                    }
            }
    });
    ComboBox expect that 'beforeload' event should be fired before 'load', but #loadRawData fire only the 'load' event ... which cause a truthy value for #ignoreSelection

    Regards,

    PHaroZ

  2. #2
    Ext JS Premium Member
    Join Date
    Jun 2011
    Location
    Ottawa, Ontario, Canada
    Posts
    123
    Vote Rating
    1
    whalethewise is on a distinguished road

      0  

    Default


    I have the same issue. Any fix or workaround found?

    Thanks

  3. #3
    Ext JS Premium Member
    Join Date
    Dec 2007
    Posts
    38
    Vote Rating
    0
    PHaroZ is on a distinguished road

      0  

    Default


    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.

Thread Participants: 1