Hybrid View

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    50
    Answers
    1
    Vote Rating
    0
    sathyan_8294 is on a distinguished road

      0  

    Default Unanswered: Select Field

    Unanswered: Select Field


    hai all,
    i want to list the records in select field from store...how to do these...

  2. #2
    Sencha User
    Join Date
    Oct 2011
    Location
    Noida, India
    Posts
    78
    Answers
    2
    Vote Rating
    2
    jiindal1988 is on a distinguished road

      0  

    Default


    Check following example:

    var storeValue=loadCommentStore();

    function loadCommentStore()
    {
    Ext.regModel('preferencesComments', {
    fields: [
    "text",
    "id"
    ]
    });
    var store = new Ext.data.Store({
    model:'preferencesComments',
    proxy: {
    type: 'memory',
    reader: {
    type: 'json',
    model: 'preferencesComments',
    root:'comments'
    }
    }
    });
    commentsdata = eval("(" + commentsdata + ")");
    store.loadRecords(store.proxy.reader.read(commentsdata).records);

    return store;
    }

    In the select field you can specify the variable in which your store is (in this case its storeValue.)

    xtype: 'selectfield',
    name:'PreConfigureComment',
    store: storeValue,
    displayField: 'text',
    valueField: 'text',
    listeners:{
    change: function(selectField, value){
    var form = myform.getValues();
    // do your processing
    }
    }


    Description:

    Function loadCommentStore() return the store which is kept in variable storeValue, this variable is used in store config of the select field .

    Hope this helps.

Thread Participants: 1