Is it possible to apply css or bootstrap buttons to an unknown column using jquery functions?
Is it possible to apply css or bootstrap buttons to an unknown column using jquery functions?
vaishnavkoka
Posts: 132Questions: 23Answers: 1
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @vaishnavkoka ,
Yep, this example here shows a tooltip being created with a hidden column. The data for that row will be available.
Cheers,
Colin
hey @colin ,
I hope you have gone through my "sample" link, here is the screenshot i have attached, I would like to change the value to green(using css) if the "YES" is detected in my datatable row else it would red( if "NO" is detected), here the column is unknown to me , i have made an rectangle whose values need to be colored.
http://prntscr.com/lc2yym
Thanks
Koka
In your
format()
function to display the child detail rows you would add logic to set the CSS appropriately based on the value of the data. If you need help with this please post a test case with an example of your data and your code. Without a test case with your specific data and code it would be difficult to provide a complete answer.https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Hi @kthorngren ,
I wish i could give you a test case, but I the url i have for ajax purpose doesnt work now, anyway here is the sample
I would like to apply a css on "salary", which is an uknown column, Is there any way to achieve it ?
I thought of achieving this task with the help for "columnDef and render function, but target is unknown to me.
The test case doesn't have to use your ajax data source. It just needs an example of your data that can be applied to Datatables using the
data
option.Using the example you linked to I created this example that uses applies red to any salary that is less than $100,000 (length of salary string is less than 8). Otherwise it applies blue.
http://live.datatables.net/huqireka/1/edit
Ashton Cox has a salary of $86,000 so it will be red. All others on the first page are above $100,000 so will be blue.
HTH,
Kevin
Thanks @kthorgren,
This is exactly what i was looking for.
Regards
Koka