Store和Jsonstore的用法简单解析

1、store

运用proxy发送请求的store

var store=new Ext.data.Store({
                  proxy : new Ext.data.HttpProxy({// 配置数据源代理
                url : 'GI/gameInfo_searchByFields.action',
                timeout:3000
              }),
             reader:new Ext.data.JsonReader({
                   totalProperty : 'totalProperty', //这里指的是查询出来的条数,也是由服务器传递过来的
                   root : 'root'   //JSON对象的key指定,这里指的是服务器传递过来的json变量的命名
             }, [   
                      {name:'service_id'},
                      {name:'inline_type'},
                       {name:'realname'},
                       {name:'phoneno'},
                       {name:'mainaccountid'},
                       {name:'servicegame'},
                       {name:'gameaccount'},
                       {name:'questiontype'},
                       {name:'inline_time'},
                       {name:'created_time'},
                       {name:'pcall_id'},
                       {name:'closed_csrname'},
                   ])
           });



后面的这些是服务器传递过来的参数json对象里面的key,这个要一一对应的


2、JSONStore


直接配置url的JsonStore

   //创建一个jsonstore

   var IOStore = new Ext.data.JsonStore({
        url: 'login!listPatterns.action',
        root: 'patternList',
        fields: ['workPatternId', 'patternName']
    });

这里的fields在前面的combo中提到过。这两个元素是分别对应的返回来数据的不懂的话可以去那片blog中看看





你可能感兴趣的:(json,服务器,service,Blog,url,login)