How can we maintain the insertion order in SmartGwt ListGrid
There are some elements in 开发者_C百科my ListGrid which are coming from the DataSource.At client side I am adding some elements in it from multiple drop downs.I was able to save it Also.
In that Listgrid after adding some elements i am rearranging the elements by setting the ListGrid Property setCanReorderRecords(true).
In this change Order i have to save and fetch the Listgrid Record.
Example-
Combobox1 Combox2 ADD_button
id name value
1 aa 22
2 bb 33
On add button click I have added Selected elements from Combobox in the Listgrid.and change the sequence like....
id name value
5 DK 99
2 bb 33
1 aa 22
In the same order i have to save & fetch the data from the dataSource.
You need to store the sort order in the database. After a fetch you just need to sort the ListGrid by the sort order field. Now you need to register a drop handler to adjust all the sort order fields of the records involved in the resorting process. Addditionaly I would recomment to register a sortChangeHandler so, that reordering is only enabled when the ListGrid is sorted by the sort order field.
精彩评论