1. #1
    Ext User
    Join Date
    Aug 2007
    Posts
    18
    Vote Rating
    0
    sberringer is on a distinguished road

      0  

    Default Simple Reload of ComboBox

    Simple Reload of ComboBox


    I have scoured the forum, but have not really found an answer for this simple task. I have a combo box, created at page load, that needs to be reloaded with different data on some event.

    // Initial load looks like:
    var StudentDataSrc = [
    ['test','0']
    ];
    var StudentDataStore = new Ext.data.SimpleStore({
    fields: ['Description', 'Value'],
    data : StudentDataSrc
    });
    var ComboStudents = {store: StudentDataStore, displayField:'Description', valueField:'Value', typeAhead:true, mode:'local', allowBlank:false, forceSelection:true, selectOnFocus:true, emptyText : 'Select a student...'};

    // After an event (blur on text field) I am trying to reload with another set of data:
    var xxx = [
    ['S0','0'],
    ['s1', '1'],
    ['s2', '2'],
    ['s3', '3']
    ];

    var Sds = new Ext.data.SimpleStore({
    fields: ['Description', 'Value'],
    data : xxx
    });
    fieldStudents.store.loadData(Sds);

    Above does not work, just clears out the combobox

    Any help would be appreciated, thanks.

  2. #2
    Sencha User fay's Avatar
    Join Date
    Apr 2007
    Location
    Ireland
    Posts
    1,750
    Vote Rating
    9
    fay will become famous soon enough fay will become famous soon enough

      0  

    Default


    loadData() does not load another store, but a block of data. See http://extjs.com/deploy/ext/docs/out....html#loadData

    See also:

    Your code should be:

    Code:
    fieldStudents.store.loadData(xxx);
    Note: When posting code please use the CODE tags - select your code and click # in the editor bar.

  3. #3
    Ext User battisti's Avatar
    Join Date
    Oct 2007
    Location
    Brasil / PR / Cascavel
    Posts
    58
    Vote Rating
    0
    battisti is on a distinguished road

      0  

    Default


    [CODE]
    // cria o vetor que ir
    []'s Anselmo Battisti
    anselmobattistigmail.com
    del.icio.us/anselmobattisti
    battisti.wordpress.com

Thread Participants: 2