I'm trying to create datagrid, from XML and then number each record.
But I also need to sort that Datagrid.
E.g. I have:
| ID| FRUIT | COLOR |
=====================================
| 1 | Apple | Green,Red,Yellow |
| 2 | Pear | Green,Yellow |
| 3 | Strawberry | Red |
| 4 | Banana | Yellow |
| 5 | Plum | Black,Blue |
=====================================
I need to sort them by FRUIT in alphabetical order. I can do that:
myGrid.sortItemsBy("FRUIT");
but I need to keep my ID numbers as 1,2,3,4,5. So the final result would look like this:
| ID| FRUIT | COLOR |
=====================================
| 1 | Apple | Green,Red,Yellow |
| 2 | Banana | Yellow |
| 3 | Pear | Green,Yellow |
| 4 | Plum | Black,Blue |
| 5 | Strawberry | Red |
=====================================
Does anybody know how to do that?
Thanks.
But I also need to sort that Datagrid.
E.g. I have:
| ID| FRUIT | COLOR |
=====================================
| 1 | Apple | Green,Red,Yellow |
| 2 | Pear | Green,Yellow |
| 3 | Strawberry | Red |
| 4 | Banana | Yellow |
| 5 | Plum | Black,Blue |
=====================================
I need to sort them by FRUIT in alphabetical order. I can do that:
myGrid.sortItemsBy("FRUIT");
but I need to keep my ID numbers as 1,2,3,4,5. So the final result would look like this:
| ID| FRUIT | COLOR |
=====================================
| 1 | Apple | Green,Red,Yellow |
| 2 | Banana | Yellow |
| 3 | Pear | Green,Yellow |
| 4 | Plum | Black,Blue |
| 5 | Strawberry | Red |
=====================================
Does anybody know how to do that?
Thanks.