Change value of json data

Change value of json data

g041496g041496 Posts: 1Questions: 1Answers: 0

hi! i have a datatable with json data.
the table looks like this

Code | Description | Option1 | Option2
0001 | Sample1 | [x] | [x]

Option1 and Option2 is a rendered checkbox with default value of False.

now how can i change the value of the json data when i check the checkbox?

this is how i get the value:

var dta = table.row($(me).closest("tr")).data();
var getvalue = dta.option1; --this returns false since the value i pass is false

here is how i render the checkbox column

{
"data": "option1",
"render": function (data, type, row, meta) {
return <input type="checkbox" class="custom-control-input" id="option1">
},
"display": "Option1 ",
"class": "text-center"
}

when i tick the check box the value i get is False. how can i change the value when i tick the checkbox.

thanks in advance.

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @g041496 ,

    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

This discussion has been closed.