Reputation: 1583
How do I update a TableItem
in a specific row index in a SWT
Table
I load a table full of data, double click it to load them in multiple components and would like to update the information into the same row.
Can someone help me please.
Upvotes: 0
Views: 1648
Reputation: 20985
In order to update a row, use the setText()
and setImage()
methods of the corresponding TableItem()
.
For example:
TableItem item = table.getSelection()[ 0 ]; // assumes a single selected item
item.setText( 1, "update first column" );
// or
item.setText( new String[]{ "col 1 value", "col 2 value" } );
// or, for a single-columned table
item.setText( "updated value" );
Upvotes: 3
Reputation: 111142
Use the
public TableItem(Table parent, int style, int index)
constructor. This lets you specify the row index of the new item.
This is assuming you are just using Table
and TableItem
rather than the JFace TableViewer
.
Upvotes: 2