How to set the datatable cell value using "oTable.cell($tr, 10).data();" using cell ID
How to set the datatable cell value using "oTable.cell($tr, 10).data();" using cell ID
laxmipark
Posts: 22Questions: 8Answers: 0
I have created the Datatable in Jquery. right now I am computing New salary from the input field in the table and getting the New Salary field like this ( which you can see is 11th column). I would like to achieve this using Cell id or className of the cell , not the column number.
here
var New_sal = curr_salary * (1 + 0.01 * Merit_incr);
$tr = var $tr = $(this).closest('tr');
oTable.cell($tr, 10).data(New_sal);
Is it possible?
Thanks
This discussion has been closed.
Answers
Yes - use
columns.className
to set the class for the column and then use the column selector with a class:Allan
Full list of options for the column selector is available here.
Allan
Hello,
I have changed as you said I have assigned class to the column as below
{ "data": "New_Salary", className : "New_Slry","title": "New Salary Rounded", className: "dt-heade-center", className: "dt-body-right", render: $.fn.dataTable.render.number(',', '.', 2) },
oTable.cell($tr, '.New_Slry').data(New_sal);
This gives me error as in image
Can you give me a link to the page showing the issue so I can trace it thought please?
Allan