on 2014 Dec 19 9:37 AM
Hello everyone,
I currently have an sap.ui.table with selection mode set to sap.ui.table.SelectionMode.MultiToggle and selection behavior to sap.ui.table.SelectionBehavior.Row.
My question is if there is any way I can programmatically(not by clicking on the table rows) select more than 1 row from the table. For example when the selection mod is set to sap.ui.table.SelectionMode.Single , i can use the setSelectedIndex(index).At first, I was expecting that setSelectedIndex(index) will add the row to the currently selected rows, but it just erase all previously selections and selects the current row.
Is there any workaround for this? Thank you.
Request clarification before answering.
Hi Alex,
I think "addSelectionInterval()" is what you are looking for.
https://openui5.hana.ondemand.com/#docs/api/symbols/sap.ui.table.Table.html#addSelectionInterval
Regards
Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Andreas,
Thanks for the quick answer. The addSelectionInterval() is not quite what I need because, this function selects all the rows from startIndex to endIndex, so for this example: addSelectionInterval(0,2), all rows from index 0 to index 2 will be selected. What I need is to select only items from certains positions , not all items beetween those position. So for my previous example, i need to select items from index 0 and index 2, not from index 1 too. I hope I was more clear now.
Best regards
And what if I don't want to select a block of rows?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But this just selects intervals 1-x .. what about if I want to select 1, 5, 7 etc? a given sequence..
Hi, we have come in to a provisional solution.
The only method available in the TreeTable library that is able to set indexes without overwriting the previous selections is table.addSelectionInterval(0, 0), lk with that command you can add to the selection index the one in the 0 position.
Be aware that a bug is present in this work-flow, an infinite loop will be created, to prevent this use the command like this:
setTimeout( () => {linesTable.addSelectionInterval(0, 0)}, 1000 );
This is not a very clean solution but is the only way to make that posible nowadays, hope this help you and willing that sapui5 will resolve that issue.
Kind Regards,
Novotic-team
User | Count |
---|---|
61 | |
8 | |
7 | |
6 | |
6 | |
4 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.