0

How can I change the background color of a Slickgrid table? I didn't find any useful material from internet.

Erik Schierboom
  • 16,301
  • 10
  • 64
  • 81
Muneeb Nasir
  • 2,414
  • 4
  • 31
  • 54

1 Answers1

4

I have found two other stackoverflow questions that deal with background colors for rows:

  1. Unable to set CSS properties for rows in Slickgrid
  2. 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