Unable to set CSS properties for rows in Slickgrid

邮差的信 提交于 2019-12-13 04:09:29

问题


I'm trying to set a CSS class to rows in Slickgrid. I've looked up here and here, and created a test code according with this Slickgrid example. Here it is:

    var cols = [{ id: "id", name: "Report name", field: "Description", width: 600, sortable: true}];

    var options = {
       enableCellNavigation: true,
       enableColumnReorder: false,
       syncColumnCellResize: true,
       showHeaderRow: true,
       headerRowHeight: 30
    };

    $(function () {
      var data = [];
      for (var i = 0; i < 10; i++) {
        data[i] = {
            Description: "Task " + i
        };
      }
      data.getItemMetadata = function (index) {
        if (index == 0) {
            return { "cssClasses": "test" };
        }
      };

      grid = new Slick.Grid("#listV", data, cols, options);
      grid.setSelectionModel(new Slick.RowSelectionModel());
   });

The 'test' CSS class only colors the background of the row with red.

What happens is that when I load the page, I can see the first row flash with red for a second, but as soon as the page is loaded the background color is back to what it is for other rows.

What can be the issue here? Thanks a lot!

来源:https://stackoverflow.com/questions/10529686/unable-to-set-css-properties-for-rows-in-slickgrid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!