数据访问工具
var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: searchNodeFromLuceneDataUrl
}),
reader:new Ext.data.JsonReader({
totalProperty: 'totalCount',
idProperty:'nodeId',
root:'data',
remoteSort: true,
fields: [
'nodeId','nodeName', 'nodeType', 'path'
]
})
});
刷新数据
function relushDataFunction(start){
var store = searchRstGridPanel.store;
store.reload({params:{
workspaceName:activeWorkspaceName,
nodeName:Ext.getDom('search_nodeName').value,
path:Ext.getDom('search_nodePath').value,
start:start,
limit:pageSize
}});
};
新建gridPanle
var searchRstGridPanel = new Ext.grid.GridPanel ({
store: store,
trackMouseOver:false,
disableSelection:true,
loadMask: true,
colModel: new Ext.grid.ColumnModel({
defaults: {
width: 120,
sortable: true
},
columns: [
new Ext.grid.RowNumberer(), // 自动序号
{header: '节点名称', dataIndex: 'nodeName'},
{header: '路径', dataIndex: 'path'},
{header: '节点类型', dataIndex: 'nodeType'},
{id: 'nodeId', header: '标识', width: 200, sortable: true, dataIndex: 'nodeId', align:'center'}
],
listeners:{'click':function(){alert()}}
}),
viewConfig: {
forceFit: true,
getRowClass: function(record, index) {
}
},
bbar: new Ext.PagingToolbar({
store: store,
displayInfo: true,
pageSize: pageSize,
prependButtons: true,
displayMsg : '显示第 {0}条到 {1}条记录,总共 {2}条',
emptyMsg : "没有记录",
doLoad:function(start){
relushDataFunction(start); // 调用函数刷新数据
this.cursor = start; // 更新页签
}
}),
anchor:'100%',
height:238,
frame: true,
border:false,
iconCls: 'icon-grid'
});