The best way to select a row at table initialization stage

The best way to select a row at table initialization stage

jstuardojstuardo Posts: 91Questions: 37Answers: 0
edited May 2020 in Free community support

Hello,

I have a DataTable which first column is a checkbox. Upon some condition, the checkbox should be checked and the row selected.

I tried to do that in createdRow callback:

createdRow: function (row, data, dataIndex) { if (data.seleccionado) { $('#chkTrab_' + data.id).prop('checked', true); $(row).select(); } }

But that does not work.

How can I do it? Or should I use InitComplete callback by traversing all the rows and selecting them depending on condition of a data in the row?

Thanks

Jaime

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.