Info: SmartGWT 3.0 pro nightly, FF 13
I'm trying to do something quite simple but I can't get the hang of it.
I have a SQLDataSource bound ListGrid that is automatically showing new records that are added into the DB by an associated DynamicForm. This works as expected: the new row is added into the database, however the new record is added to the top of the ListGrid.
The ListGrid is set to have sorting done like this:
I guess there is some gap in my understanding - I would have thought that the ListGrid knowing that the DataSource's ResultSet was updated that it would sort the results for displaying.
Another thread mentioned attaching to the DataChanged event on the ResultSet via setDataProperties to do a scrollToRow (which is what I want to do next). However I'm not sure how to sort from within the DataChanged event as calling a sort directly there has no effect, as I assume the record hasn't been drawn on the grid yet. The DataChanged event also doesn't seem to expose the changed records, so we would have to obtain a copy of the record before calling getRecordIndex and scrollToRow?
I'm trying to do something quite simple but I can't get the hang of it.
I have a SQLDataSource bound ListGrid that is automatically showing new records that are added into the DB by an associated DynamicForm. This works as expected: the new row is added into the database, however the new record is added to the top of the ListGrid.
The ListGrid is set to have sorting done like this:
Code:
grid.setSort(new SortSpecifier[]{ new SortSpecifier("surname", SortDirection.ASCENDING), new SortSpecifier("firstname", SortDirection.ASCENDING) });
Another thread mentioned attaching to the DataChanged event on the ResultSet via setDataProperties to do a scrollToRow (which is what I want to do next). However I'm not sure how to sort from within the DataChanged event as calling a sort directly there has no effect, as I assume the record hasn't been drawn on the grid yet. The DataChanged event also doesn't seem to expose the changed records, so we would have to obtain a copy of the record before calling getRecordIndex and scrollToRow?
Comment