jquery-bootgrid
jquery-bootgrid copied to clipboard
How can I add background color for a row
Hey there,
I've been struggling with this a little and I am unable to add or override extra css to my grids. The title just resumes a little need, so I would be grateful if anyone could help telling me what I am doing wrong. I have been trying through jQuery and directly by the "style" html tag, but nothing.
That's actually easy and built in, although perhaps not obvious from the documentation. Look up "statusMapping".
Off the top of my head.. (1) return a field called "status" with every row (2) add a statusMapping object into your bootgrid initialization. In there, map the integer vlues of "status" to a class name. So in my case for example I have: statusMapping: { 0: "text-muted", 2: "text-danger", 5: "warning", 6: "warning", 7: "danger" } which maps those status values onto Bootstrap 3 classes. Job done.
@philwig, thanks for clarifying that. It was very helpful. I think the documentation should be edited to provide and example and make it abundantly clear.
That's actually easy and built in, although perhaps not obvious from the documentation. Look up "statusMapping".
Off the top of my head.. (1) return a field called "status" with every row (2) add a statusMapping object into your bootgrid initialization. In there, map the integer vlues of "status" to a class name. So in my case for example I have: statusMapping: { 0: "text-muted", 2: "text-danger", 5: "warning", 6: "warning", 7: "danger" } which maps those status values onto Bootstrap 3 classes. Job done.
In bootstrap, to modify a complete file:
statusMapping: { 0: "text-muted", 2: "table-primary", 5: "table-secondary", 6: "table-success", 7: "table-danger" },
Reference to Bootstrap row's style: https://getbootstrap.com/docs/5.0/content/tables/
Results: