Prashant P
Prashant P

Reputation: 21

Select table values to text field using SWT?

I have Table (TableViewer) containing TableItems with values. I have another class TextField mapped according to table column name.

Now my question is: When I select any row in table, the values in that row should get reflected in Text field. In Text field I can edit these vales and save to to table. Please let me know how I can achieve this?

Upvotes: 0

Views: 599

Answers (1)

ctangudu
ctangudu

Reputation: 84

What ever "Baz" has said is the right thing to do. If editing is table data is requirement, then make the table columns as editable. But if you want to specifically edit table row separately in a control (like Text field), then get IStructuredSelection from TableViewer and get the data in control to edit. Then after you edit, get the data back from control and set it back to table. Hope it helps.

Upvotes: 1

Related Questions