Set multiple row selection on powertable

A power table I made has the ability to change the order (a user can click an up and down button to move rows up and down). Getting the selection and updating the order works like it should.

The problem is that the selection isn’t updated. F.e. when a user selects rows [4, 5, 6], and presses the up-button, the selection should become [3, 4, 5].

But I can only find a way to set the selection to a single row. So the selection either stays [4, 5, 6], or I can set the selection to [3].

This is rather annoying for users, as they might want to move that set of rows another place higher, but they can’t just click the same button again as the selection is wrong.

I found that a table has a .selectedRow attribute that can be set (but only sets a single row to be selected), and a .selectedRows attribute, but the latter is read-only, so doesn’t help.

Is there any way to set such a selection?

This is a feature missing from the power table. You can implement it yourself by getting a reference to the underlying JideTable:

table = event.source.parent.getComponent('Power Table')
jideTable = table.getTable()

You then have to access its ListSelectionModel (

listSelectionModel = jideTable.getSelectionModel()

The list selection model has a couple of methods to allow you to set and add multiple rows. For example, to select rows 1, 2, 3, 5 and 6, you could use:

listSelectionModel.setSelectionInterval(1, 3)
listSelectionModel.addSelectionInterval(5, 6)

Hopefully this helps.


Thanks a lot, I didn’t realise I needed to use getTable() to find the original Java table.