mortelee | 21 Jun 2012 19:52
Picon

Sorting statefulmodel (dojo 1.8)

Hi,

See my following code:

When I call sort on the model the result is not sorted. What am I missing?

Regards

Marco

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Sorting-statefulmodel-dojo-1-8-tp3986807.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
________________________________________________________
Dojotoolkit: http://dojotoolkit.org
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api
Tutorials: http://dojotoolkit.org/documentation

Dojo-interest <at> mail.dojotoolkit.org
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Ed Chatelain | 22 Jun 2012 22:36
Picon

Re: Sorting statefulmodel (dojo 1.8)

Marco,

        StatefulModel does not have support for sort().  You can wrap your data in a new MemoryStore and sort it on the query before creating the model, with something like this:
var memStore1 = new MemoryStore({data : search_results_init1});
when(memStore1.query({}, {sort:[{attribute:"First", descending: true}]}), function(data){

If you are running with trunk/1.8  you could also use an EditStoreRefListController instead of a StatefulModel, and when you call queryStore(query,options) on the EditStoreRefListController to populate the model if you want to sort the data you can pass options like this:
var options = {sort:[{attribute:"reminderDate", descending: true},{attribute:"priority", descending: true}]};

Note that you should be sure your data is in a format that MemoryStore can sort.
Hope that  helps.

Regards,
Ed
On Thu, Jun 21, 2012 at 1:52 PM, mortelee <marco.ortelee <at> philips.com> wrote:
Hi,

See my following code:



When I call sort on the model the result is not sorted. What am I missing?

Regards

Marco

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Sorting-statefulmodel-dojo-1-8-tp3986807.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
________________________________________________________
Dojotoolkit: http://dojotoolkit.org
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api
Tutorials: http://dojotoolkit.org/documentation

Dojo-interest <at> mail.dojotoolkit.org
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

________________________________________________________
Dojotoolkit: http://dojotoolkit.org
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api
Tutorials: http://dojotoolkit.org/documentation

Dojo-interest <at> mail.dojotoolkit.org
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Gmane