ExtJs的Ext.create('Ext.data.Store')得到始终空记录!疯了!!!
你说吧!!!这个简单的东西,为什么结果就是0!!!!第一个是javascript前台,第二个是ashx后台。这么简单的东西!!!!
var store=Ext.create('Ext.data.Store',{
model:'Users',
proxy:{
type:'ajax',
url:'App_Ashx/Demo/Grid.ashx',
reader:{
//type:'json',
totalProperty:'totalCount',
root:'data'
}
}
});
alert(store.getCount());
public void ProcessRequest(HttpContext context)
{
context.Response.Clear();
context.Response.ContentType = "text/plain";
//context.Response.ContentType = "json/application";
context.Response.Write("{"totalCount":2,"success":true,"data":[{"Name":"wys","Gender":"mail"},{"Name":"wys1","Gender":"mail"}]}");
}
var store=Ext.create('Ext.data.Store',{
model:'Users',
proxy:{
type:'ajax',
url:'App_Ashx/Demo/Grid.ashx',
////////////////////////
listeners:{load:function(store,records,success,opts){alert(store.getCount())}},
reader:{
//type:'json',
totalProperty:'totalCount',
root:'data'
}
}
});
alert(store.getCount());