1. #1
    Sencha User
    Join Date
    Jan 2013
    Location
    Bangalore
    Posts
    9
    Vote Rating
    1
    SunilRao is on a distinguished road

      0  

    Default How to set selectfield option dynamically from url

    Hi,
    Can anyone show me how the selectfield options could be dynamically inherited from database.

    Code:
    var store = Ext.create('Ext.data.Store', {

    fields: ['status_desc'],
    proxy: {
    type: 'jsonp',
    url : ticketapp.app.getHost() + '/ticket/ws/selectoption_server.php?status=status',

    reader: {
    type: 'json',
    rootProperty: 'status'
    }
    },
    autoLoad: true,

    listeners : {
    load : function() {
    store.data.each(function(record) {
    var resulttextsts = new Array(record.get('status_desc'));
    //resulttextsts[] = record.get('status_desc');
    //var optionlist = new Array({text: resulttextsts, value: resulttextsts})
    //var resulttextsts = record.get('status_desc');
    //var resulttextstsid = record.get('status_id');
    //console.log(optionlist);



    console.log(store.data);

    Ext.getCmp('ticketstatusfield').setOptions([
    {text: resulttextsts, value: resulttextsts}
    ])



    });

    }
    }

  2. #2
    Sencha User
    Join Date
    Jan 2013
    Location
    Bangalore
    Posts
    9
    Vote Rating
    1
    SunilRao is on a distinguished road

      0  

    Default

    Found the solution!.
    Thanks for the help........