jquery-bootgrid icon indicating copy to clipboard operation
jquery-bootgrid copied to clipboard

How can I add background color for a row

Open sonirico opened this issue 9 years ago • 4 comments

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.

sonirico avatar Jul 27 '15 19:07 sonirico

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 avatar Aug 26 '15 15:08 philwig

@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.

ksidibe avatar Dec 19 '16 09:12 ksidibe

Example can be found here: Link

Line: 72 is how you add the 'status' to each row.

Andrewthedev avatar Dec 01 '17 19:12 Andrewthedev

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:

Snap 2021-10-23 at 14 19 59

estebanquito266 avatar Oct 23 '21 17:10 estebanquito266