Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
sencha touch-如何在面板的initcomponent中读取多个json对象(ajax响应)_Ajax_Json_Sencha Touch_Storage_Iteration - Fatal编程技术网

sencha touch-如何在面板的initcomponent中读取多个json对象(ajax响应)

sencha touch-如何在面板的initcomponent中读取多个json对象(ajax响应),ajax,json,sencha-touch,storage,iteration,Ajax,Json,Sencha Touch,Storage,Iteration,需要读取从ajax请求获取的多个json对象。我使用了下面给出的代码。时间太长了。因此,其他代码在该代码之前执行 var allVisitStore = new Ext.data.Store({ model: 'allVisit', autoLoad : true, proxy: { type: 'ajax', id: 'allvisit_app_localstore', url: '/RadMobApp/api', extraParams:{

需要读取从ajax请求获取的多个json对象。我使用了下面给出的代码。时间太长了。因此,其他代码在该代码之前执行

var allVisitStore =  new Ext.data.Store({ 
model: 'allVisit',
autoLoad : true,
proxy: {
    type: 'ajax',
    id: 'allvisit_app_localstore',
    url: '/RadMobApp/api',
    extraParams:{          
        action:'test',
        queryName:'GET_ALL_TEST',
        username:'1234',
        password:'1234',
        retFormat:'XML',
        patTicketId: '4098'
        keyValuePair:'yes'
    },
    // the return will be XML, so lets set up a reader
    reader: new Ext.data.XmlReader({
        // records will have an "T4" tag
        record: 'data'
    })
}
}))


对于上述所有Sencha Touch中的Ajax请求,以及ExtJS都是异步的,是否有任何替代方法。 当商店装载时,你需要做任何你需要做的事情

侦听存储“加载”事件,然后继续处理

您可以在存储配置中添加侦听器,如下所示:

var allVisitStore =  new Ext.data.Store({ 
model: 'allVisit',
autoLoad : true,
proxy: {
    type: 'ajax',
    id: 'allvisit_app_localstore',
    url: '/RadMobApp/api',
    extraParams:{          
        action:'query',
        queryName:'GET_ALL_VISIT',
        username:'superuser',
        password:'superuser',
        retFormat:'XML',
        patTicketId: 'PAT-4098'
        keyValuePair:'yes'
    },
    // the return will be XML, so lets set up a reader
    reader: new Ext.data.XmlReader({
        // records will have an "T4" tag
        record: 'data'
    }),
    listeners : {
        'load' : function(){

            // call code here that should be run when the data has returned

        }
    }
}
allVisitStore.on('load',function(){
// call code here that should be run when the data has returned
或者像这样:

var allVisitStore =  new Ext.data.Store({ 
model: 'allVisit',
autoLoad : true,
proxy: {
    type: 'ajax',
    id: 'allvisit_app_localstore',
    url: '/RadMobApp/api',
    extraParams:{          
        action:'query',
        queryName:'GET_ALL_VISIT',
        username:'superuser',
        password:'superuser',
        retFormat:'XML',
        patTicketId: 'PAT-4098'
        keyValuePair:'yes'
    },
    // the return will be XML, so lets set up a reader
    reader: new Ext.data.XmlReader({
        // records will have an "T4" tag
        record: 'data'
    }),
    listeners : {
        'load' : function(){

            // call code here that should be run when the data has returned

        }
    }
}
allVisitStore.on('load',function(){
// call code here that should be run when the data has returned

}))

谢谢你的回复,我已经这样使用了,但没有任何结果,它不存储任何值。还有别的办法吗