When you have a SmartColumn in a table, scout needs to do the Lookup "key -> text" for each row. As you mentioned, in some cases it can be expensive. This is why there is an additional concept: BatchLookupCall / BatchLookupService.
The idea is to first collect all the rows and the required LookupCall and to process them in one batch.
To answer your question, I had to set up a small playground project. Here the key points I have noticed:
Type of your key
Batch LookupCall check the equals method of your call which relies on the equality of the key Object. If you are using a custom Type as key, ensure equals()
and hashCode()
is properly implemented.
Way of adding rows in the table
If you add the rows one after the other, like this:
Table table = getMyTableField().getTable();
ITableRow r;
r = table.addRow(table.createRow());
table.getTextColumn().setValue(r, "Lorem");
table.getMyColumn().setValue(r, 1L);
r = table.addRow(table.createRow());
table.getTextColumn().setValue(r, "Ipsum");
table.getMyColumn().setValue(r, 3L);
r = table.addRow(table.createRow());
table.getTextColumn().setValue(r, "Dolor");
table.getMyColumn().setValue(r, 1L);
r = table.addRow(table.createRow());
table.getTextColumn().setValue(r, "Figus");
table.getMyColumn().setValue(r, 4L);
Scout computes the table content too often… I could observe too many calls to the lookup service. I think there is some optimization possibility in this domain.
This does not happen if you import all your rows in one step, for example using the TableData included in the FormData or in the TablePageData.