Use data from other column as object attribute in another checkbox rendered column
Use data from other column as object attribute in another checkbox rendered column
aira.h
Posts: 2Questions: 1Answers: 0
in DataTables
I'm trying to access data from other column and attach it as object attribute in another rendered column.
In this case I have PstCode
column and checkbox column. I want to add PstCode
as id
attribute in checkbox column
"columns": [
{ "data": "PstCode" },
{ "data": "PstText" },
{
"data": "checkbox",
render: function (data, type, row) {
if (type === 'display') {
return '<input type="checkbox" class="editor-active" id=([row.'PstCode']) onclick=Bindcb(this) name="cb">';}
return data;
}}]
This discussion has been closed.
Answers
I tried this code too but it is also didn't work
On the first code, you've got a second
return
which would never be reached.We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin