View Full Version : Can't make working the 'root' property of Ext.util.Sorter to sort a store

8 Dec 2014, 5:59 AM

I am trying to sort my store depending on the following hierarchy "data.lastItem.creation" with data described as follow:
"1: constructor
data: Object1
creation: 1417530818510


My sorter is defined as follow:

store: menuCheckItem.getStore(),
root: menuCheckItem.root, ('data', 'lastItem' or 'data.lastItem')
property: menuCheckItem.property,

I've tried to set the root property to 'lastItem' or event 'data.lastItem', nevertheless I still get the following error:
Uncaught TypeError: Cannot read property 'creation' of undefined

I don't understand why it can't reach the lastItem structure.

Thank you very much.
Kind Regards,
Michael Jeulin-L.

8 Dec 2014, 4:54 PM
Hi Michael--

Can you provide your store/model config, as well as an example of your data structure? I'm a little fuzzy on what your data looks like and what you're trying to do.


9 Dec 2014, 1:19 AM
Thank you for your reply.

I am trying to sort my list given the 'creation' field of the 'lastItem' attribute of my data.
Here is how the data looks like:

"messages":["threads ok"],
"content":[ // List of threads

"users":[{...}, ...}], // list of users

and the fields of my model:

fields: [
defaultValue: null
'lastItem', // ThreadItem
'sender', // Users
'users', // Users Array

Then the cleaner to my mind was to put the root as 'lastItem', howerver it does not work.
Thank you very much.

15 Dec 2014, 1:25 AM
i wonder then if it isn't a bug from ext? For now I'm using a custom 'sorterFn' and 'elm.data.lastItem.creation' to make it works properly.