Home >Web Front-end >JS Tutorial >How to set the background color and font color of a certain column in extjs grid_extjs

How to set the background color and font color of a certain column in extjs grid_extjs

WBOY
WBOYOriginal
2016-05-16 18:20:05826browse

css code:

Copy code The code is as follows:

.x-grid-back-red {
background: #FF0000;
}


js code:
Copy code The code is as follows:

{
header: 'divide type',
dataIndex: 'divideType',
renderer: function(v,m){
m.css='x-grid-back-red';
return v;
},
width : 60
}

Or you can write it directly like this
Copy code The code is as follows:

{
header: 'Number',
dataIndex : 'fcId',
css : 'background: #FF0000;',
width : 40
}

extjs grid sets the font color of a certain row
css Code:

Copy code The code is as follows:

.x-grid-record- red table{
color: #FF0000;
}

js code:
code
Copy code The code is as follows:

viewConfig: {
forceFit: true,
getRowClass: function(record,rowIndex,rowParams,store){
// Disable data display in red
if(record.data.zt==0){
return 'x-grid-record-red';
}else{
return '';
}
}
},
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn