[code="java"]
Ext.onReady(function(){
var store = new Ext.data.JsonStore({
root: 'topics',
totalProperty: 'totalCount',
idProperty: 'autoID',
remoteSort: false,
fields:[
'formOrder',
'formLabel',
'formName',
'isView',
'viewForm',
'autoID'
],
proxy: new Ext.data.ScriptTagProxy({
url: 'asp/loadFormList.asp'
})
});
//store.setDefaultSort('formOrder', 'asc');
function renderForm(value, p, record){
return String.format(
'<a href="{0}">查看</a>',
value
);
}
var grid = new Ext.grid.GridPanel({
width:700,
height:500,
title:'FormList',
store: store,
disableSelection:true,
loadMask: true,
stripeRows: true,
columns:[{
id: 'formOrder',
header: "排序",
dataIndex: 'formOrder',
width: 70,
sortable: true
},{
header: "表单名",
dataIndex: 'formLabel',
width: 150,
sortable: true
},{
header: "数据表",
dataIndex: 'formName',
width: 150,
align: 'right',
sortable: true
},{
header: "是否虚拟表",
dataIndex: 'isView',
width: 100,
sortable: true
},{
header: "真实表",
dataIndex: 'viewForm',
width: 150,
sortable: true
},{
header: "查看",
dataIndex: 'autoID',
width: 70,
renderer: renderForm,
sortable: true
}],
bbar: new Ext.PagingToolbar({
pageSize: 25,
store: store,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display"
})
});
grid.render('formList');
store.load({params:{start:0, limit:25}});
});
loadFormList.asp 输出的是 {'totalCount':'1','topics':[{'formOrder':'1','formLabel':'测试','formName':'test','isView':'False','viewForm':'','autoID':'1'}]}
[/code]