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

Source: Internet
Author: User

Css code:
Copy codeThe Code is as follows:
. X-grid-back-red {
Background: # FF0000;
}


Js Code:
Copy codeThe Code is as follows:
{
Header: 'split into type ',
DataIndex: 'dividetype ',
Renderer: function (v, m ){
M.css = 'x-grid-back-red ';
Return v;
},
Width: 60
}

Or you can write it like this.
Copy codeThe Code is as follows:
{
Header: 'number ',
DataIndex: 'fcid ',
Css: 'background: # FF0000 ;',
Width: 40
}

Extjs grid sets the font color of a line
Css code:

Copy codeThe Code is as follows:
. X-grid-record-red table {
Color: # FF0000;
}

Js Code:
Code
Copy codeThe 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 '';
}
}
},

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.