我有两个 JSON 对象,我必须在 ExtJs 网格中显示这是我的网格,我从 Servlet 获得的数据我得到一个空的网格
//getting the response from Servlet
var proxy=new Ext.data.HttpProxy({url:'LoginServlet'}); // this is the Servlet
var reader=new Ext.data.JsonReader( //store
{
},[
{name:'username',mapping:'username'}, //field s of Grid
{name:'password'}//
var store=new Ext.data.Store({ //data Store
proxy:proxy, //proxy
reader:reader,//
root:"obj" //
});
store.load(); //loding the store
var grid=new Ext.grid.GridPanel({ //creating the Grid panel
store:store,//
columns:[
{header:"username",width:60,dataIndex:'username'}, //setting
{header:"password",width:60,dataIndex:'password'}
],
renderTo:Ext.getBody(),
width:420, //
height:200