indexes in select/deselect does not return all row indexes as mentioned in documentation
indexes in select/deselect does not return all row indexes as mentioned in documentation
Hi,
See indexes in http://live.datatables.net/tudofuga/37/edit
Steps to reproduce:
1. Select multiple rows, either in multiple clicks or single click with cmd
2. watch the consoled output of indexes.
Result: It is always the last selected/deselected row index even though wrapped in an Array [].
As per documentation of select,
The result is that if multiple items are selected in a single action (shift click in the os selection style for example) each item selected does not receive its own event, but rather the information about the selected items is conveyed in an array.
Can this be resolved.?
This question has an accepted answers - jump to answer
Answers
Use either the
select.style
os
ormulti+shift
to select multiple rows, for example:http://live.datatables.net/heyalipe/1/edit
Kevin
@kthorngren
This still gives only the last made selection within indexes. I was expecting it to give back all indexes of all rows selected. Isn't that what makes sence in having it as an array.
In my test case select the Ashton Cox row, the
select
event is triggered with one element in the array. Hold the shift key and select Bruno Nash. You will see an array of 5 elements. Is this what you are looking for?Kevin
The
select
event indexes are the indexes of the rows selected that triggered the event not all the selected rows. This seems correct as you would expect to only get information about the elements that triggered the event.This example shows how to get the selected rows. You can use something like this to get all the selected row indexes:
Kevin
Thanks, I've now fetched all the selected rows this way itself.
From the documentation, I expected the indexes [] to have more than one values, atleast when row-selections are made together. Was checking in to see if it is a bug that can be fixed.
Please provide the steps of row selections made together where there isn't an array of indexes. Your original example has
select.style
ofmulti
which allows for multiple selections but they are made one at a time each invoking the event handler. The key is this part fo what you quoted:Using
multi
doesn't support using shift click.Kevin