开发者

extJs Json Reader

Please help me with this problem. I'm new in extJs and i need a little help. I have this code

Ext.onReady(function() {
 var datesStore = new Ext.data.JsonStore({
  start : 'StartTableDate',
  end : 'FinishTableDate',  
            autoLoad : true,
            proxy : new Ext.data.HttpProxy({
                url : 'dates.json',
                method:'GET'
            }),
            fields : [
                // 2 mandatory fields
                {name:'StartTableDate'},
                {name:'FinishTableDate'}
            ]
        });

// i want to pass to variable start si end the values from JSON
var start = 'Sta开发者_JAVA技巧rtTableDate';
var end = 'FinishTableDate';


If I understand you correctly, you want to get the values from the first record of a JsonStore and assign them to variables. If that's the case, then I think you want an event handler:

var datesStore = new Ext.data.JsonStore({
            proxy : new Ext.data.HttpProxy({
                url : 'dates.json',
                method:'GET'
            }),
            fields : ['StartTableDate','EndTableDate']
        });
datesStore.on('load',function(dataStore,records,options) {
    if (records.length > 0) {
        var start = records[0].get('StartTableDate');
        var end = records[0].get('FinishTableDate');
     }
},this);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜