sorting a column in a dataGrid by dateTime

Peter Haworth pete at lcsql.com
Tue Dec 10 16:37:29 EST 2013


Hi Curt,
I don't think you need any code to do the sort in a datagrid.  In the
Inspector for the datagrid, go to the columns tab, select the column that
needs to be sorted by date, then down at the bottom select "datetime" from
the "Type" menu.  When the user clicks on the date column, it should sort
correctly.

Pete
lcSQL Software <http://www.lcsql.com>


On Tue, Dec 10, 2013 at 1:03 PM, FORD JR., CURT <CFORD at mailbox.sc.edu>wrote:

> Thanks, Richard & Alex - sometimes I get stuck because I don't expect how
> simple LiveCode can make something. So experimenting with a field, this
> works fine:
>
>
> on mouseUp
>
>    put fld "source" into tSource
>
>    sort tSource dateTime
>
>    put tSource into fld "result"
>
> end mouseUp
>
> Now - is there a way to adapt that for a data grid?
>
> Looking at
> http://lessons.runrev.com/s/lessons/m/datagrid/l/7330-how-do-i-customize-column-sorting I tried putting this in the script for the data grid:
>
>
> on SortDataGridColumn pColumn
>
>
>
>    switch pColumn
>
>       case "Time"
>
>          sort pColumn dateTime
>
>          break
>
>
>
>       default
>
>          pass SortDataGridColumn
>
>
>
>    end switch
>
>
>
> end SortDataGridColumn
>
>
> ..but nothing seems to change - is there a step I'm missing? Does the
> column need to get reloaded somehow?
>
>
> The lines in the column have the abbrev date concatenated with the long
> time, for example: Wed, Nov 13, 2013 8:19:15 PM
>
>
> Thanks again for any help -
>
>
> Curt
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list