日期:2014-05-16  浏览次数:20477 次

ExtJs生成复选框和序号
var sm = new Ext.selection.CheckboxModel();
var record_start = 0;
var myGird = Ext.create('Ext.grid.Panel', {
	store : mystore,
	selModel:sm, //添加复选框   Ext.create('Ext.selection.CheckboxModel')
	columns : [{text:'序号',width:30,renderer:function(value,metadata,record,rowIndex){
		  return record_start + 1 + rowIndex;//添加序号
	 }},{
		text : 'Name',
		dataIndex : 'name'
	}, {
		text : 'Email',
		dataIndex : 'email',
		flex : 1
	}, {
		text : 'Phone',
		dataIndex : 'phone'
	} ],
/*	// forceFit:true,
	width : '100%',
	height : '80%',
	// renderTo : 'mainc',
*/				dockedItems : [ {
		xtype : 'pagingtoolbar',
		store : mystore, // same store GridPanel is using
		dock : 'bottom',
		displayInfo : true,
		emptyMsg : "没有数据",
		displayMsg : "显示从{0}条数据到{1}条数据,共{2}条数据",
		pageSize : 2
	} ]

});