Sorting datagrid column with a tricj?

Bob Sneidar bobsneidar at iotecdigital.com
Fri Nov 2 18:16:00 EDT 2018


Okay, looks like this is a no go. I read from one of the datagrid lessons in reference to populating the datagrid "by hand": 

Important: When using this technique properties like dgData, dgText, dgDataOfIndex, etc. will no longer return values. The data grid is just displaying records from your data source. It does not store any of that data internally. 

What I would like to see added to the datagrid is a handler that intercepted the population of a field so what goes into the field can be custom formatted. This comes up a lot. Dates and numbers from an SQL query are unformatted, and having to go through the datagrid when populating and formatting each record's data before displaying it, and then reformatting it before pushing it back up to the database seems like more work than necessary. 

Bob S


> On Nov 2, 2018, at 14:42 , Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> In a table datagrid, can't you edit the column template so that you can control what goes into the field for that column? I think the underlying data will remain the same, but what goes into the field is what you put there. I suspect the datagrid will then sort by the underlying data, not the displayed data. 
> 
> I have a similar issue with SQL formatted dates, but I want to display them as long dates. I'll toy around with this and see what I come up with. 
> 
> Bob S
> 
> 
>> On Nov 2, 2018, at 14:26 , Klaus major-k via use-livecode <use-livecode at lists.runrev.com> wrote:
>> 
>> Hi Bob,
>> 
>>> Am 02.11.2018 um 22:14 schrieb Bob Sneidar via use-livecode <use-livecode at lists.runrev.com>:
>>> 
>>> There is no way I know of to have a datagrid sort by an invisible column and still show that it is sorted by a visible one. Every time the datagrid "redraws" it's going to update the appearance of the header to reflect the sort. 
>> 
>> I was afraid of that.
>> 
>>> If you want to force the sort when you populate the datagrid, then set the dgProp ["sort by column"] of the datagrid to the column you want, and then if the user sorts by a different column, well that's on them. 
>> 
>> We have a german app for Android and LC on Android still does not support "system date"! :-/
>> So I wanted to fake sorting a column with long german dates by sorting by a hidden column with an english date.
>> Will have to roll my own with list fields.
>> 
>> Thank you!
>> 
>>> Bob S
>> 
>> Best
>> 
>> Klaus
>> 
>> 
>> --
>> Klaus Major
>> http://www.major-k.de
>> klaus at major-k.de
>> 
>> 
>> _______________________________________________
>> 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
> 
> 
> _______________________________________________
> 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