javascript - Assigning CSS Style to Slickgrid Cells - Stack Overflow

Slickgrid is continuosly evolving so some of the answers to similar issues are not applicable (e.g., th

Slickgrid is continuosly evolving so some of the answers to similar issues are not applicable (e.g., they mention it was not possible to assign a CSS to a specific cell). Apparently now this is supported and would appreciate if someone could provide an example using the CSS API at :

grid.setCellCssStyles("birthday_highlight", {
   0: {
        birthday: "highlight", 
        age: "highlight" 
       },

   9: {
         birthday: "highlight",
         age: "highlight"
       }
})

I have a very simple grid with A-Z columns and 1-100 rows: how can I assign a yellow background if the content of the cell is a number?

Thanks

Slickgrid is continuosly evolving so some of the answers to similar issues are not applicable (e.g., they mention it was not possible to assign a CSS to a specific cell). Apparently now this is supported and would appreciate if someone could provide an example using the CSS API at https://github./mleibman/SlickGrid/wiki/API-Reference:

grid.setCellCssStyles("birthday_highlight", {
   0: {
        birthday: "highlight", 
        age: "highlight" 
       },

   9: {
         birthday: "highlight",
         age: "highlight"
       }
})

I have a very simple grid with A-Z columns and 1-100 rows: how can I assign a yellow background if the content of the cell is a number?

Thanks

Share Improve this question asked Jul 21, 2012 at 11:25 GianGian 5493 gold badges7 silver badges18 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

This can be done with by implementing getItemMetadata(row) (see https://github./mleibman/SlickGrid/wiki/Providing-data-to-the-grid), but you'd have to iterate over all cells, so that's not very efficient. Perhaps a custom formatter that looks at the actual value is a better fit. With that, you won't be able to specify a CSS class for the cell itself, but you'd be able to style the cell content however you like, so technically you could make a DIV that fills the whole cell and set background on that.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744879412a4598748.html

相关推荐

  • javascript - Assigning CSS Style to Slickgrid Cells - Stack Overflow

    Slickgrid is continuosly evolving so some of the answers to similar issues are not applicable (e.g., th

    1天前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信