View Full Version : In Store, loadData() with filterOnLoad breaks sort.

9 Mar 2011, 6:24 AM
I tested sencha-touch-1.0.1a/examples/list-search after some compile fix.
It works well. sorting is good, searching(filtering) is good.

But when I changed the source to use loadData(), the search result is not sorted any more :(

I found that it is because of filterOnLoad (default is true).

If filterOnLoad is true, filter() is called in loadData().
-> In filter(), this.snapshot is made from unsorted data.
-> If sortOnFilter is true, sort() will sort the data but snapshot remains unsorted.

Now, the problem starts.
For search, filterBy() is used in keyup.
-> In filterBy(), snapshot remains same. because snapshot is already existed!!!
-> In queryBy(), snapshot is used for data, which is UNSORTED.
---> so the result is UNSORTED. (no sortOnFilter for filterBy(). sorry.)

If filterOnLoad was false, snapshot will be made in filterBy(), so it will be sorted.

This seems quite serious. Correct me if I'm wrong.