leon1509 发表于 2013-1-29 07:29:22

在Grid上添加两行工具栏(搜索用)、根据数据确定某行使用的CSS

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;};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 }      ];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',      tbar : searchBar});yourGrid.on("render", function(){      tbar2 = new Ext.Toolbar({   renderTo : yourGrid.tbar,   items : ['two', '-', {      text : 'search',      iconCls : 'search'   }, '-']    });})
页: [1]
查看完整版本: 在Grid上添加两行工具栏(搜索用)、根据数据确定某行使用的CSS