我先在分页工具栏增加一个按钮,要扩展吗?
[code="js"] bbar: new Ext.PagingToolbar({
pageSize: 25,
store: store,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display",
items:[
text:'新增的按钮
}]
})[/code]
官方有示例
[quote]我先在分页工具栏增加一个按钮,要扩展吗?[/quote]
直接加就是了..
[code="java"]Ext.onReady(function(){
Ext.QuickTips.init();
var data =[ ['rowen','hohai','basketball','2004-11-01'],
['yyy','hohai','football','2004-01-11'],
['ysc','hohai','pingpong','2004-01-21'],
['yww','hohai','pingpong','2004-01-31']
];
var reader=new Ext.data.ArrayReader({},
[{name:'name'},{name:'school'},{name:'sport'},{name:'year',type:'date',dateFormat:'Y-m-d'},{name:'desc'}]
);
var store =new Ext.data.Store({
data:data,
reader:reader,
sortInfo:{field:'name',direction:'desc'}
});
var sm = new Ext.grid.CheckboxSelectionModel();
var cm =new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(),sm,
{header:'姓名',sortable:true,width:160,dataIndex:'name'},
{header:'入学年份',sortable:true,width:160,dataIndex:'school',editor: new Ext.form.TextField({
allowBlank: false
})},
{header:'运动爱好',sortable:true,width:160,dataIndex:'sport'},
{header:'入学年份',sortable:true,width:160,dataIndex:'year',renderer: Ext.util.Format.dateRenderer('Y-m-d')}
]);
grid =new Ext.grid.GridPanel({
title:'groupGrid',
store:store,
cm:cm,
width:600,
height:500,
frame:true,
//draggable :true,
enableDragDrop:true,
sm:sm,
viewConfig: {
forceFit:true
},
//animCollapse:true,
collapsible:true,
// inline toolbars
tbar:[{
text:'Add Something',
tooltip:'Add a new row',
iconCls:'add',
handler:function(){
alert("Add Something");
}
}, '|', {
text:'Options',
tooltip:'Blah blah blah blaht',
iconCls:'option'
},'|',{
text:'Remove Something',
tooltip:'Remove the selected item',
iconCls:'remove'
}],
renderTo:document.body,
bbar:new Ext.PagingToolbar({
pageSize:2,
store:store,
displayInfo:true,
displayMsg:'显示第{0}到第{1}条记录,一共{2}条',
emptyMsg:"没有记录",
items:[{text:'分页栏的按钮',handler:function(){alert("你点击了此按钮");}}]
})
});
});[/code]