Define rows selection in a TableField at server side. [message #1294086] |
Sun, 13 April 2014 02:00  |
Eclipse User |
|
|
|
Hi,
In the application I am working on, I need to control the selection in a TableField from the Scout Server.
I am wondering where I should put this information.
1/ Variable on the form (rowId as int ?)
[Problem] it is not coupled with the table Field (I need to make the field aware that it need to store the selection information in this variable)
[Problem] In the TableFieldData the rows are ordered, but after an import in the TableField, I am not sure that this order is preserved.
2/ Table Status
The current statuses are:
* STATUS_NON_CHANGED
* STATUS_INSERTED
* STATUS_UPDATED
* STATUS_DELETED
I could try to add additional status to mark which row is selected.
I don't think that it is a good idea, because those status are used internally by the table.
3/ CustomValue
With Bean based TableData, it is possible to add a custom value on the row.
The Idea is to add a custom value to mark it as selected.
row.setCustomColumnValue(ITableFieldConstants.SELECTED, selected);
To retrieve this customValue information, I need to extend the current "TableRowMapper".
I cannot set the selected values on the table before they are imported in the table. Otherwise I will get an Exception (A).
The problem is that the mapper isn't notified when the mapping is over. Even if I manage to retrieve the "Selected" value for each rowData in TableRowDataMapper.importTableRowData(ITableRow, AbstractTableRowData). I will not be able to use this information to select the corresponding rows when the rows are imported.
4/ Boolean column
I could add an undisplayable boolean Column (SelectedColumn) in the table.
I could intercept importFormFieldData on the tableField and add some code to select the rows according to the content of the SelectedColumn
(A) Execption Stack trace
When you try to import a ITableRow that is not in the table:
Caused by: java.lang.IllegalArgumentException: only accept InternalTableRow, not class org.eclipse.scout.rt.client.ui.basic.table.TableRow
at org.eclipse.scout.rt.client.ui.basic.table.AbstractTable.resolveRow(AbstractTable.java:3514)
at org.eclipse.scout.rt.client.ui.basic.table.AbstractTable.resolveRows(AbstractTable.java:3532)
at org.eclipse.scout.rt.client.ui.basic.table.AbstractTable.selectRows(AbstractTable.java:2021)
at org.eclipse.scout.rt.client.ui.basic.table.AbstractTable.selectRow(AbstractTable.java:2006)
at org.eclipse.scout.rt.client.ui.basic.table.AbstractTable.selectRow(AbstractTable.java:2000)
|
|
|
|
|
Re: Define rows selection in a TableField at server side. [message #1295473 is a reply to message #1295441] |
Mon, 14 April 2014 05:48  |
Eclipse User |
|
|
|
Quote:- we do not have multiple selection: it is possible to tell a checkable table, that only one row is checked?
Yes, see getConfiguredMultiCheck
Quote:- this pattern should be used in combination with Table and GroupBox for details on row selection.
For this use case I personally would NOT use a checkable table. Instead I would try to implement the selection behaviour on the client. If you don't have all the information available I would create either a (hidden) column or a property on the table field template. I don't think the server really has to know which row should be selected on the gui.
Quote:From a technical point of view, a checkable table is near to the solution 4 I have proposed, isn't it?
Yes.
|
|
|
Powered by
FUDForum. Page generated in 0.05184 seconds