如何设置grid某列的背景颜色
展开全部
Ext.grid.CheckColumn.prototype ={
init : function(grid){
this.grid = grid;
this.grid.on('render', function(){
var view = this.grid.getView();
view.mainBody.on('mousedown', this.onMouseDown, this);
}, this);
},
onMouseDown : function(e, t){
if(t.className && t.className.indexOf('x-grid3-cc-'+this.id) != -1){
e.stopEvent();
var index = this.grid.getView().findRowIndex(t);
var record = this.grid.store.getAt(index);
var en = {
grid: this.grid,
record: record,
field: this.dataIndex,
value: record[this.dataIndex],
cancel:false
};
if(this.grid.fireEvent("beforeedit", en) !== false && !en.cancel){
record.set(this.dataIndex, !record.data[this.dataIndex]);
}
}
},
renderer : function(v, p, record){
p.css += x-grid3-check-col-td';
return '<div class="x-grid3-check-col'+(v?'-on':'')+' x-grid3-cc-'+this.id+'"> </div>';
}
};
修改红色地方的 css 就可以实现你想要的功能
init : function(grid){
this.grid = grid;
this.grid.on('render', function(){
var view = this.grid.getView();
view.mainBody.on('mousedown', this.onMouseDown, this);
}, this);
},
onMouseDown : function(e, t){
if(t.className && t.className.indexOf('x-grid3-cc-'+this.id) != -1){
e.stopEvent();
var index = this.grid.getView().findRowIndex(t);
var record = this.grid.store.getAt(index);
var en = {
grid: this.grid,
record: record,
field: this.dataIndex,
value: record[this.dataIndex],
cancel:false
};
if(this.grid.fireEvent("beforeedit", en) !== false && !en.cancel){
record.set(this.dataIndex, !record.data[this.dataIndex]);
}
}
},
renderer : function(v, p, record){
p.css += x-grid3-check-col-td';
return '<div class="x-grid3-check-col'+(v?'-on':'')+' x-grid3-cc-'+this.id+'"> </div>';
}
};
修改红色地方的 css 就可以实现你想要的功能
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询