I have a datagrid which displays the values from the Dataset. The Dataset
values are not sorted alphabetically. So the datagrid initially displays the
values in an unsorted manner. Only when I click on the header of the datagrid
the values are displayed in assorted manner. I want the datagrid to display the
values in alphabetical order when it is loaded with the values. Can this be
done ?
If so anyone please let me know how to do that .
KLee - 21 Dec 2006 13:00 GMT
If you are loading the data into the grid from a database, put an order by in your select with the order you want the grid loaded with.
ie. Select * from table
where ...(optional)
order by column1, column2 etc
From http://www.developmentnow.com/g/70_2006_12_0_0_867047/Datagrid-Sorting.ht
Posted via DevelopmentNow.com Group
http://www.developmentnow.com
Scott Johnson - 21 Dec 2006 14:15 GMT
sort the dataset prior to loading it into the datagrid.
Check the help files for dataset.addSort() and dataset.userSort()
Basically you will use the dataset.addSort()
dataset.addSort(name,field);
name = name you want to call this sort
filed = the field you want to sort on.
Then you call the dataset.useSort()
dataset.useSort(name)
name = what you called the sort in addSort.
Now your dataset is sorted.
> I have a datagrid which displays the values from the Dataset. The Dataset
> values are not sorted alphabetically. So the datagrid initially displays the
[quoted text clipped - 3 lines]
> done ?
> If so anyone please let me know how to do that .