当前位置:编程学习 > C#/ASP.NET >>

extjs jsonReader

小弟我今天想了解一下 ext 的datastore 和 JsonReader
碰到一个问题 不知道如何取到数据?
首先我创建了一个aspx 页面

       <script type = "text/javascript">
        Ext.onReady
        (
         function()
            {

             
  
                var store = new Ext.data.Store
                (
                    {    
                        proxy : new Ext.data.ScriptTagProxy({url:'sent.ashx'}),    
                       reader: new Ext.data.JsonReader({

                            successProperty: "successProperty",

                            totalProperty: "totalProperty",

                            root: "root",

                            id: "id"

                            }, 

                            [
                            {name: 'id'},
                            {name: 'name'}
                            ] 
                         )    
                    }
                 );    
              //store.load({params:{start:0, limit:10}}); 
              
                store.load({callback:function(records, options, success)
                { 
                    alert('info');
                    alert(success);

                }
                }); 
                
                   
             }
        );


sent.ashx 中的内容

        context.Response.ContentType = "text/plain";
        string data = "{id:0,totalProperty:2,successProperty:true,root:[{id:'id1',name:'name1'},{id:'id2',name:'name2'} ]}";
        
        context.Response.Write(data);


补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,