如题,初学extjs
[code="java"]
var store =new Ext.data.JsonStore({
autoLoad:true,
proxy:new Ext.data.HttpProxy({url:"http://localhost:8080/rbs/Login_testLogin.action"}),
// data:[{"id":1,"name":"图片","typeValue":"pic"},{"id":2,"name":"视频","typeValue":"avi"}],
fields:["id","name","typeValue"],
})
[/code]
上面的代码中,url里的action返回的string结果就是下面注释行中data的内容
但是当我使用注释行里写死的数据的时候,grid才能加载到数据,而用proxy获取action返回数据的时候,却不行
然后是action的代码
[code="java"]
List lt = service.findListByParam("from Types types");
JSONArray jsonObject = JSONArray.fromObject(lt);
outputStr = jsonObject.toString();
System.out.println(outputStr);
PrintWriter out = ServletActionContext.getResponse().getWriter();
getResponse().setContentType("text/javascript;charset=GBK");
out.print(outputStr);
return null;
[/code]