How to make a decision depending on value of a cell.
How to make a decision depending on value of a cell.
Hi, I have a table which uses server-side processing to deal with a db that gets around 500k new rows a day. The db is updated via external scripts and the table is only built when someone views the page.
One of the columns contains a value of either yes or no. I want to be able to display a link in that cell if it is yes. I'm already using the following for 1 column and it works well.
"columnDefs": [ {
"targets": 0,
"data": null,
"defaultContent":
"<button class='btn btn-small '><li class='fas fa-play-circle 2x' id='play'>Play</li></button><li class='fas fa-thumbtack'></li>"
},
i have a handler
$('#calltable tbody').on( 'click', 'button', function () {
which works for that button.
I want to have an icon
<li class="fas fa-thumbtack" onclick="showModal(-- row number --)"><li>
in the row where the cell value = 'Yes'.
So i also need to know how to identify the row number.
any help greatly appreciated.
Replies
Instead of
columns.defaultContentyou can usecolumns.render. The function has ametaparameter you can use to get the row index.Kevin
Brilliant... @kthorngren - worked perfectly.