var lineColor = function(record,rowIndex,rowParams,store){
//锁定用户显示红色
var _flag = record.data['flag'];
var _css;
if(_flag == "0") _css = 'x-grid-record-red';
else if(_flag == "1") _css = 'x-grid-record-blue';
else _css = 'x-grid-record-gray';
return _css;
};
[color=red]var searchBar = [
' ', '姓名:', ' ', { xtype : 'textfield', width : '70', id : 'q_name' },
' ', '学/工号:', ' ', { xtype : 'textfield', width : '85', id : 'q_sno' },
' ', '部门:', ' ', { xtype : 'textfield', width : '120', id : 'q_dept' },
'->', { xtype : 'button', text: '搜索', iconCls : 'page_find', handler : doQuery }
];[/color]
var yourGrid = new Ext.grid.GridPanel({
bodyStyle : 'width:100%',
viewConfig : { forceFit : true, getRowClass : lineColor },
columns : cm,
store : ds,
loadMask : { msg : '操作中......' },
stripeRows : true,
border : false,
autoExpandColumn : 'memo',
[color=red]tbar : searchBar[/color]
});
[color=red]yourGrid.on("render", function(){
tbar2 = new Ext.Toolbar({
renderTo : yourGrid.tbar,
items : ['two', '-', {
text : 'search',
iconCls : 'search'
}, '-']
});
})[/color]
在Grid上添加两行工具栏(搜索用)、根据数据确定某行使用的CSS
最新推荐文章于 2020-07-09 22:42:37 发布