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 badges1 Answer
Reset to default 3This 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
评论列表(0条)