中易网

如何用ExtJs获取sql表中的数据

答案:1  悬赏:60  
解决时间 2021-01-18 18:16
  • 提问者网友:沉默的哀伤
  • 2021-01-17 18:28
如何用ExtJs获取sql表中的数据
最佳答案
  • 二级知识专家网友:愁杀梦里人
  • 2021-01-17 20:01
C#为例
//数据库取出数据 遍历如json中
int count=0;
foreach (DataRow dr in ds.Tables[0].Rows)
{
json.AddItem("id", dr["id"].ToString());
json.AddItem("username", dr["username"].ToString());
count++;
}
json.totalCount = count;
jsons = json.ToString();
return jsons;
//js代码
var fields = ["id","username"];
ILOVEMMStore= new Ext.data.GroupingStore({
proxy: new Ext.data.HttpProxy(
{
url: ".....路径",
method: "POST"
}),
reader: new Ext.data.JsonReader(
{
fields: fields,
root: "data",
id: "id",
totalProperty: "totalCount"

})
});
ILOVEMMStore.load();//store中存放的所有的取得的数据
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息!
大家都在看
推荐信息