Results 1 to 4 of 4

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

  1. #1
    Sencha User
    Join Date
    Nov 2014
    Posts
    5
    Answers
    1

    Default Can't make working the 'root' property of Ext.util.Sorter to sort a store

    Hi,

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

    My sorter is defined as follow:
    Code:
    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
    Ext.define.defaultSorterFn
    "

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

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

  2. #2
    Sencha User joel.watson's Avatar
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446

    Default

    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.

    Thanks!

  3. #3
    Sencha User
    Join Date
    Nov 2014
    Posts
    5
    Answers
    1

    Default

    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:
    Code:
    {
        "code":1200,
        "messages":["threads ok"],
        "count":6,
        "content":[ // List of threads
        {
            "id":1503,
            "title":"test",
            
            "users":[{...}, ...}], // list of users
            "sender":{...},
            "creation":1381156670261,
            "itemsCount":2,
            "lastItem":{
                "id":177,
                "content":"...",
                "sender":{...},
                "children":[...],
                "users":[...],
                "creation":1381156992999,
            },
        },
        }],    
        "success":true
    }
    and the fields of my model:
    Code:
    fields: [
        'entityId',
    'entityType',
    {
            name:'attachedComponents',
    defaultValue: null
    },
    'creation',
    'id',
    'lastItem',                     // ThreadItem
    'private',
    'reference',
    'sender',                       // Users
    'title',
    'users',                        // Users Array
    'itemsCount',
    'hasAllComponentUsers',
    'rights'
    ],
    Then the cleaner to my mind was to put the root as 'lastItem', howerver it does not work.
    Thank you very much.

  4. #4
    Sencha User
    Join Date
    Nov 2014
    Posts
    5
    Answers
    1

    Default

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •