这是extjs的代码
Ext.regModel('User',{
fields:[
{name: 'appeId'},
{name: 'survId'},
{name: 'location'},
{name: 'surveyDate'},
{name: 'surveyTime'},
{name: 'inputUserId'}
]
});
var proxy=new Ext.data.proxy.Ajax({
type:'ajax',
url:'survey.html'
});
//构建Store
var store=new Ext.data.Store({
proxy:proxy,
model:'User',
autoLoad: true,
render:'json'
});
store.add({appeId:'qwe',survId:'123',location:'123',surveyDate:'s',surveyTime:'s',inputUserId:'s'});
store.sync();
//载入
store.load();
// create the grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{text: "appeId", width: 60, dataIndex: 'appeId', sortable: true},
{text: "survId", width: 60, dataIndex: 'survId', sortable: true},
{text: "location", width: 60, dataIndex: 'location', sortable: true},
{text: "surveyDate", width: 100, dataIndex: 'surveyDate', sortable: true},
{text: "surveyTime", width: 100, dataIndex: 'surveyTime', sortable: true},
{text: "inputUserId", width:80, dataIndex: 'inputUserId', sortable: true}
],
renderTo:'example-grid',
width:540,
height:200
});
这是survey.html
[{"appeId":"1","survId":"1","location":"","surveyDate":"2008-03-14","surveyTime":"12:19:47","inputUserId":"1","inputTime":"2008-03-14
12:21:51","modifyTime":"0000-00-0000:00:00"}]
值传不过来啊,store.add 自己添加的能显示出来。