Selecting Non-adjacent Rows

Hello again guys (skip first paragraph for short entry,)
As I get deeper into working with this program, I find more things that don’t seem to have the straightforward API support that other stuff does, so I am lead here to see if anyone else knows how to do what I’m trying to do, and I feel a little guilty each time. To the point though, what I’m trying to do, is use the MouseClicked script within the Table component to select multiple rows in the table. So I took a look at the setRowSelectionInterval method. It’s close to what I want, but the rows I want to select are not always right next to each other, and I can’t reorder the table to get them next to each other either (due to the nature of the table).

How do I select multiple rows in a table component that are:
1) Not next to each other
2) Without reordering the table
I do not believe that the setRowSelectionInterval method can help me.

Hi,

You can use addRowSelectionInterval

table = event.source.parent.getComponent('Table')
table.getTable().addRowSelectionInterval(1,2)
table.getTable().addRowSelectionInterval(6,8)
#etc

http://docs.oracle.com/javase/1.4.2/docs/api/javax/swing/JTable.html#addRowSelectionInterval(int,%20int)

Hope this helps,

Dan

[quote=“dep05d”]Hi,

You can use addRowSelectionInterval

table = event.source.parent.getComponent('Table')
table.getTable().addRowSelectionInterval(1,2)
table.getTable().addRowSelectionInterval(6,8)
#etc

http://docs.oracle.com/javase/1.4.2/docs/api/javax/swing/JTable.html#addRowSelectionInterval(int,%20int)

Hope this helps,

Dan[/quote]

I don’t see an “addRowSelectionInterval” or “getTable” method in the Table components list of available methods.

Yeah, I guess it isn’t documented. I just picked up somewhere that getTable will return the actual JTable object. From there you have access to basically everything inside a standard java JTable. It would probably be helpful if the user manual highlighted how to get to underlying objects, along with a link to the java documentation.

Dan

[quote=“dep05d”]Yeah, I guess it isn’t documented. I just picked up somewhere that getTable will return the actual JTable object. From there you have access to basically everything inside a standard java JTable. It would probably be helpful if the user manual highlighted how to get to underlying objects, along with a link to the java documentation.

Dan[/quote]

Oh, ok Thanks Dan. I’ve ran into that problem before, where there is something in the API but isn’t documented. Do you know if there is another place where I can get more documentation for Designer, cause I don’t like going to the forum each time when something I need isn’t in the API.

Not really, sorry. If I’m stuck on something, I’ll generally search the manual, then search through the forum, then try and see what java I can get into under the hood, then ask here or call support if I’m still stuck.

I wouldn’t feel guilty about posting here. It helps build a knowledge base for the community and highlight documentation gaps / needed features. And inevitably, you’ll find plenty of opportunities to answer questions to problems you’ve already encountered.

Good Luck!

Dan

Set the table property ‘Selection Mode’ to ‘Multiple Interval’. Mouse and will select/deselect interval rows (mouse and will select/deselect contiguous rows).

Use getSelectedRows() to return a list ints of selected rows.

[quote=“dep05d”]Not really, sorry. If I’m stuck on something, I’ll generally search the manual, then search through the forum, then try and see what java I can get into under the hood, then ask here or call support if I’m still stuck.

I wouldn’t feel guilty about posting here. It helps build a knowledge base for the community and highlight documentation gaps / needed features. And inevitably, you’ll find plenty of opportunities to answer questions to problems you’ve already encountered.

Good Luck!

Dan[/quote]

Ok thanks Dan, fortunately, I am actually a bit familiar with Java, as it was my first language, but I had no idea how much Ignition Designer depended on it, I’ll check java docs as a resource from now on. Thanks.