Remembering Sequence of Selection in Table Multi-Selection

Dear Inductive Team,

We have a requirement like: We need to do multi-selection on table and need to remember the Rows selected in Sequence. Example: Lets say, We selected Row 10 First, Row 4 Second, Row 7 Third and Row 1 last. Then our result array should be [10, 4, 7, 1].

If we use table.getSelectedRows() option, then the result Array will be [1, 4, 7, 10]. This is what we observed.

Is it possible to capture Selection Sequence for table ? If it is possible, then another issue of How it works with Shift or Control Keys ?


I’ve attached a window with a possible solution. During testing I found that the table doesn’t fire any events when using or to select, so this only works for clicking one row at a time. I’ve also had to implement my own selection highlighting.

If you load and run the window, you’ll see that you can click on items one at a time. As they are clicked, a value in the ‘selection’ column is set in order to colour the row - this column would normally be hidden. The value in the first column is then copied to a dataset which is displayed in the second ‘selection’ table. This dataset therefore contains the items you clicked in the correct order.

Hopefully you’ll be able to use this to work out a solution.
test_ordered_selection.proj (14 KB)

That solution sounds great to me. Unfortunately there is no way to get the selection order out of the getSelectedRows() function.

Thank you Al and Robert.

Your code helped us for finding a solution. Have a look at enclosed attachment for modified code. We wrote the code (not cleaned properly) in Mouse Click event and removed from property change event. This is for capturing Control, Shift key press.

We will try for some more improvement and share with you guys.
OrderedSelection.proj (26.6 KB)