| Modifying table behaviour [message #1008611] |
Wed, 13 February 2013 04:40  |
Urs Beeli Messages: 164 Registered: October 2012 Location: Bern, Switzerland |
Senior Member |
|
|
I have added a form containing a table to my application that shows messages generated on the server or by other clients (kind of an event log). I have managed to set up a client notification service that keeps this table updated with the latest content. However there is one issue I have not managed to solve.
I disabled sorting of the table (SortEnabled=false) so the entries always appear in the correct order. By default, I want the table to always show the latest entries (which are at the bottom of the table). However, filling the table with updated data scrolls back to the top of the table.
What I've done currently is the following:
In my form class I have:
public void refreshForm() throws ProcessingException {
IMessageListProcessService service = SERVICES.getService(IMessageListProcessService.class);
MessageListFormData formData = new MessageListFormData();
exportFormData(formData);
formData = service.load(formData);
importFormData(formData);
setEnabledPermission(new ReadTabbedPermission());
getTableField().getTable().selectLastRow();
getTableField().getTable().deselectAllRows();
}
public class DisplayHandler extends AbstractFormHandler {
@Override
public void execLoad() throws ProcessingException {
refreshForm();
}
}
The client notification handler then just calls form->refreshForm().
This scrolls the table to the bottom when refreshForm() is called from the notification handler, but not on its initial call, when the form is filled from form.DisplayHandler.execLoad().
So I have two questions:
- is there a better way to enforce that the table always scrolls to show its bottom entry?
- any ideas why my hack above does not work on the initial population of the table?
|
|
|