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中看看

相关文章

AJAX是一种基于JavaScript和XML的技术,能够使网页实现异步交...
在网页开发中,我们常常需要通过Ajax从后端获取数据并在页面...
在前端开发中,经常需要循环JSON对象数组进行数据操作。使用...
AJAX(Asynchronous JavaScript and XML)是一种用于创建 We...
AJAX技术被广泛应用于现代Web开发,它可以在无需重新加载页面...
Ajax是一种通过JavaScript和HTTP请求交互的技术,可以实现无...