Search and selectAll : select only searched rows
Search and selectAll : select only searched rows
teriblus
Posts: 4Questions: 1Answers: 0
in Bug reports
I wanted to add something on this thread : https://datatables.net/forums/discussion/9861
But it is closed !
So for those wondering how to select all searched rows, here is the code i use :
datatable.rows({search: 'applied'}).select();
If you need a button to select all, here is the code to add to the "buttons" option of the datatable:
buttons : [{
text: 'Tout sélectionner', action: function (e, dt, node, config) {
datatable.rows({search: 'applied'}).select();
}]
Replies
Thanks for sharing!
Maybe one hint: If you know the name of the Data Table you can of course use the name as you do in "datatable.rows..." but since "dt" is passed into the action function you can use "dt.rows ..." which doesn't require you to know the name of the Data Table beforehand.
You can also make a reusable custom button from this called "selectAllSearchApplied".
And use it like this in any of your Data Tables without having to repeat its definition.
And another one selecting just the first twenty rows:
Thanks for this, @rf1234!