How can I change the background color of a Slickgrid table? I didn't find any useful material from internet.
Asked
Active
Viewed 4,386 times
1 Answers
4
I have found two other stackoverflow questions that deal with background colors for rows:
- Unable to set CSS properties for rows in Slickgrid
- SlickGrid 2.0 can't change row background color in odd indexes
From those question's answers, the answer appears to be to add a getItemMetadata
function to your data object. This function can then return an object literal, one of its fields being cssClasses
. So if you define a CSS class named "my-row-class" that sets the background color of a table row, you can add that class to the rows in your Slickgrid using:
data.getItemMetadata = function (index) {
return { "cssClasses": "my-row-class" };
};

Community
- 1
- 1

Erik Schierboom
- 16,301
- 10
- 64
- 81