Results 1 to 2 of 2

Thread: Unable to add data to store of combobox?

  1. #1
    Touch Premium Member
    Join Date
    Sep 2011
    Posts
    33

    Default Unable to add data to store of combobox?

    I have tried the following from various examples and none of them work:



    Code:
    folderCombo.store.add({text: 'All', value: 'ALL'}); folderCombo.getStore.add({text: 'All', value: 'ALL'});
     folderCombo.getStore().add(new grid.store.recordType({text: 'All', value: 'ALL'})); 
    folderCombo.store().add(new grid.store.recordType({text: 'All', value: 'ALL'}));
    folderCombo.getStore().add(folderCombo.getStore().recordType({text: 'All', value: 'ALL'}));
    This is folderCombo:
    Code:
    this.folderCombo = new Ext.form.ComboBox({
                store: new Ext.data.SimpleStore({
                    fields: ["text", "value"],
                    // data: [[getLangValue("lLive"),0],[getLangValue("lArchived"),1], [getLangValue("lAll"),"ALL"]]
                    data: []
                }),
                displayField: "text",
                valueField: "value",
                mode: "local",
                editable: false,
                triggerAction: "all",
                value: "",
                width: 150
            });
    If I console.log folderCombo.store it shows the current store but never the store with the extra data item I try to add above.Please advise.

  2. #2
    Sencha User
    Join Date
    Jan 2012
    Posts
    1,376

    Default

    You must use queryMode:'local' instead of mode:'local'

    Code:
    var folderCombo = new Ext.form.field.ComboBox({
        store: new Ext.data.SimpleStore({
            fields: ["text", "value"],
            data: []
        }),
        displayField: "text",
        valueField: "value",
        queryMode: "local",
        editable: false,
        triggerAction: "all",
        value: "",
        width: 150
    });
    folderCombo.getStore().add({text: 'All', value: 'all'});

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •