Sorting and saving datagrid
Posted: Sun Apr 13, 2014 7:19 pm
Hi,
I have a datagrid which downloads the contents of a MySQL database table, this is downloaded with the entries in no particular order. The table has a name column and a score column. In the datagrid I want it to be sorted by the score (descending). This can be done easily, but here comes the problem. I then want to add a column which contains a position, just by going through a loop inserting numbers as I move down the table, however when I do this it becomes clear that when I am dealing with the DG data it hasn't been sorted, it is only the stuff in the datagrid which is sorted.
So I guess what I am asking is how can you sort a datagrid and the somehow save this sorting, so that when I manipulate the data the sorting is there?
Thanks,
Matthew
I have a datagrid which downloads the contents of a MySQL database table, this is downloaded with the entries in no particular order. The table has a name column and a score column. In the datagrid I want it to be sorted by the score (descending). This can be done easily, but here comes the problem. I then want to add a column which contains a position, just by going through a loop inserting numbers as I move down the table, however when I do this it becomes clear that when I am dealing with the DG data it hasn't been sorted, it is only the stuff in the datagrid which is sorted.
So I guess what I am asking is how can you sort a datagrid and the somehow save this sorting, so that when I manipulate the data the sorting is there?
Thanks,
Matthew