[Dojo-interest] Issue with filtertable sorting JSON dates

Tom Trenka dojo-interest at dept-z.com
Fri Dec 15 09:14:08 MST 2006

Ross Thomas wrote:
> Mike Bowie-2 wrote:
>> Thanks for the swift response Tom.
>> The first thing I tried after your reply was to cast the type for each 
>> row as it was added to the table via the io load, ala:
>> var targetTable = dojo.widget.byId('fileTable');
>> // Iterate Json data
>> for (var i = 0; i < json.length; i++) {
>>     targetTable.store.addData({
>>         Id:json[i]['Id'],
>>         Title:json[i]['Title'],
>>         Created: new Date(json[i]['Created'])
>>     });
>> }
>> But for around a hundred records, it takes almost twenty seconds, ...
> Each addData() call will effectively perform a render() (which also
> includes a sort!).
> Try creating an array of objects and then calling:
>    targetTable.store.addDataRange(arr)
> If you get too many objects to be comfortable with, do it in chunks, say
> 100-200
> at a time.
> HTH.
> Ross.

This is accurate.  One of the things I tend to do is pre-process any data
coming across the wire before using it with a Store; I'll do things like
casting, the addition of new properties that might not be part of the set,
any kind of transformations, etc.

And it is always more effiecient to use addDataRange over addData.

View this message in context: http://www.nabble.com/Issue-with-filtertable-sorting-JSON-dates-tf2823713.html#a7894329
Sent from the Dojo mailing list archive at Nabble.com.

More information about the Dojo-interest mailing list