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

      1  

    Default [4.0.6] ComboBox with paging remotestore doesn't trigger query on setValue

    [4.0.6] ComboBox with paging remotestore doesn't trigger query on setValue


    REQUIRED INFORMATION


    Ext version tested:
    • Ext 4.0.2a
    • Ext 4.0.6

    Browser versions tested against:
    • Chrome

    Description:
    I have a paging remote store, which autoloads the first 10 entries, and a combobox that is linked to it. When calling setValue on the combobox (for instance from a form loadRecord) and the value is in the current clientside records, the combobox is filled properly with the value. If the value is not found, I would expect setValue to perform a remote query and defer filling the combobox until the correct record is loaded.

    Test Case:

    Assuming there is a 'StationStore' that is remote, and has loaded record with id's 1-10, but also can query for records 11-100

    Code:
    var cb = Ext.create('Ext.form.ComboBox', {
        fieldLabel: 'Choose Station',
        store: 'StationStore',
        displayField: 'id',
        valueField: 'id',
        renderTo: Ext.getBody()
    });
    
    cb.setValue(1); // works
    cb.setValue(11); // combobox is empty, no query is triggered


    HELPFUL INFORMATION


    Possible fix:

    I've created a workaround for setValue, which loads the store when a value is submitted that doesn't match the current local records, and defers setValue until the store is reloaded.

    Code:
    Ext.define('Jool.RemoteComboBox', {
    	extend: 'Ext.form.field.ComboBox',
    	alias: 'widget.remotecombobox',
    
    	setValue: function(value) {
    		// no support for multiselect
    		var rec = Ext.isArray(value) ? value[0] : value;
    		var v = (Ext.isObject(rec) && rec.isModel) ? rec.get(this.valueField) : rec;
    		if(v) {
    			// test if value can be found in local records of store
    			rec = this.findRecordByDisplay(v);
    			if(!rec && v != this.lastQuery) {
    				// defer setValue until store has reloaded
    				this.store.on('load', Ext.bind(this.setValue, this, arguments), this, {
    					single: true
    				});
    				// perform remote search, without showing picker
    				this.lastQuery = v;
    				if (this.pageSize) {
    					this.loadPage(1);
    				} else {
    					this.store.load({
    						params: this.getParams(v)
    					});
    				}
    				return;
    			}
    		}
    		this.callParent(arguments);
    	}
    });
    
    var cb = Ext.create('Jool.RemoteComboBox', {
        fieldLabel: 'Choose Station',
        store: 'StationStore',
        displayField: 'id',
        valueField: 'id',
        renderTo: Ext.getBody()
    });
    
    cb.setValue(1); // works
    cb.setValue(11); // works now too

  2. #2
    Sencha User
    Join Date
    Jan 2012
    Location
    Detroit MI, Clearwater FL, Toronto ON, Halifax NS, Denver CO
    Posts
    8
    Vote Rating
    2
    iphonewhit is on a distinguished road

      0  

    Default Still a bug?

    Still a bug?


    Anyone else experience this? I tried 4.1.1a and the newly released 4.2 beta today and also have this issue. Is this something the framework should handle or something that needs to be manually handled as per the suggested workaround above?

    In a nutshell:
    • A form uses loadrecord to set the values
    • The combobox on the form uses a remote store with paging and loads the first 10 records (eg with value id's 1-10).
    • If the value of the combobox field in the record contains a value outside the combobox (eg. id 11), it displays the id in the combobox instead of going back to the database to load the correct page.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar