2
How do I select a line from a Datatable, using Jquery, pure Javascript or the PF javascript command?
2
How do I select a line from a Datatable, using Jquery, pure Javascript or the PF javascript command?
1
Note: It is not a very elegant solution, but it solves your problem.
You can directly select a column in the desired row of the datatable via jQuery and then call the event. click()
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 two points with bar bar (\\:).
Then select a table row using the data-ri attribute and pass the index as argument:$('#form\\:singleDT_data tr[data-ri=4])
.
Finally, select a column element of the result and call . click() $('#form\\:singleDT_data tr[data-ri=4] td').click()
.
You can test this solution directly on Showcase of Primefaces
The example will select line 5 of the datatable "Single with Row Click".
Browser other questions tagged javascript java jquery jsf primefaces
You are not signed in. Login or sign up in order to post.