How to get the value of row.Id passed into a function?
How to get the value of row.Id passed into a function?
Claymist
Posts: 1Questions: 1Answers: 0
"data": "Id",
"class": "center",
"orderable": false,
"mRender": function (data, type, row) {
if (type === 'display' && row.Id) {
return '<div class="col-md-1" style="margin-left:15px;margin-top:14px"><div class="checkboxtax chk_Id"><input id="' + row.Id + '" class="chkSelected" type="checkbox" name="chkItemSelected"' + (row.IsSelected ? "checked" : "") + '><label for="' + row.Id + '"> </label></div></div>';
}
return '';
I was trying to get the row.Id value from the <input> passed to the code below
$('#tb_CreditMemoReferenceItem').on('change', function () {
if (this.checked) {
$('#txt_Amount').prop('disabled', false);
}
else {
$('#txt_Amount').prop('disabled', true);
}
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
Answers
I'd suggest using
columns.render
rather than the legacy mRender name (i.e. just change it torender
).You have a change listener on
tb_CreditMemoReferenceItem
, but there is no indication in the above code what that matches. it isn't the input element, so I'm not sure what it should be selecting.If you could post a test case please (as required in the forum rules](/forums/rules) and the new post template text), that would be really useful.
My guess it you might want to do:
Allan