How do I select a row from a DataTable, using JQuery, pure Javascript, or the javascript PF command?
How do I select a row from a DataTable, using JQuery, pure Javascript, or the javascript PF command?
Note: It is not a very elegant solution, but it solves your problem.
You can directly select a column in the desired row from the datatable via jQuery and then call the .click () event
Example:
$('#form\:singleDT_data tr[data-ri=4] td').click()
Explaining:
First you select the datatable via jQuery $('#form\:singleDT_data)
(do not forget to escape the colon with the slash bar (\\:).
Then select a table row using the data-ri attribute and passing the index as argument: $('#form\:singleDT_data tr[data-ri=4])
.
Finally, select a result column element and call the .click () $('#form\:singleDT_data tr[data-ri=4] td').click()
.
You can test this solution directly in the PrimeFaces Showcase
The example given will select row 5 from the "Single with Row Click" datatable.