Hi,
I am beginner in LiveCode, My problem is I don't know how to sort the data grid, eg: I have data grid contains id, name, accepted date, submit date, I want to sort(ascending order or descending order) the entire data grid according to the accepted date.
Data grid sorting
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Data grid sorting
Hi Shalu,
There are a number of ways to sort the datagrid.
If you are only new to Livecode and therefore new to Datagrids can I suggest you look at a plugin called Datagrid Helper.
It is very handy when it comes to formatting the datagrid.
Cheers,
Matt
There are a number of ways to sort the datagrid.
If you are only new to Livecode and therefore new to Datagrids can I suggest you look at a plugin called Datagrid Helper.
It is very handy when it comes to formatting the datagrid.
Cheers,
Matt
-
- VIP Livecode Opensource Backer
- Posts: 9669
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Data grid sorting
hi.
I always bring the data out into the clear and work on it directly within LC. I do this with either the "dgText" or the "dgData". Read about these in the DG User Guide. Something like:
There is much that can be done within the DG. There is much more that can be done (temporarily) outside it.
Craig Newman
I always bring the data out into the clear and work on it directly within LC. I do this with either the "dgText" or the "dgData". Read about these in the DG User Guide. Something like:
Code: Select all
set the itemDel to tab
put the dgText of group "yourDataGrid" into yourVariable
sort yourVariable by item 1 of each -- would sort by the first column
set the dgText of group "yourDataGrid" to yourVariable
Craig Newman
Re: Data grid sorting
HI shalu,
datagrids are higly complex so I recommend to load the docs as a PDF here: http://lessons.runrev.com/m/datagrid
and work through it a couple of time
To sort your datagrid via script, you can use the datagrid command:
SortDataByKey pArrayKey, pSortType, pDirection, pCaseSensitive
Do like this:
Best
Klaus
datagrids are higly complex so I recommend to load the docs as a PDF here: http://lessons.runrev.com/m/datagrid
and work through it a couple of time
To sort your datagrid via script, you can use the datagrid command:
SortDataByKey pArrayKey, pSortType, pDirection, pCaseSensitive
Do like this:
Code: Select all
...
## Sort your data by column "accepted date", sort by date, ascending, NOT case sensitive
dispatch "SortDataByKey" to grp "your datagrid here..." with "accepted date", "dateTime", "ascending", "false"
...
Klaus