1. #1
    Sencha User
    Join Date
    Mar 2010
    Posts
    6
    Vote Rating
    0
    jamesn is on a distinguished road

      0  

    Default Ext.data.TreeStore.getAncestor() is not available

    Ext.data.TreeStore.getAncestor() is not available


    Hi all,

    I'm working with a prototype and struggling with the new treestore.


    Code:
    Ext.regModel('Task', {
            fields: [
                {name: 'task',     type: 'string'},
                {name: 'unit_price',     type: 'string'},
                {name: 'qty', type: 'string'},
                {name: 'type', type: 'string'}
            ],
        });
        
        var store = new Ext.data.TreeStore({
            model: 'Task',
            proxy: {
                type: 'ajax',
                //the store will get the content from the .json file
                url: 'treegrid_2.json'
            },
            root: {
                expanded: true
            },
            folderSort: false,
    
        getTaskType : function (record) {
            var ancestors = this.getAncestors(record), type = '';
            if (ancestors.length > 0) {
                Ext.each(ancestors, function (record, idx, all) {
                    var t = record.get('type');
                    if (t === 'alt' || t ==='opt') {
                        type = t;
                        return false;
                    }
                });
            }
            return '';
        }
        });
    The getTaskType() navigates up the tree of tasks until it finds one with an interesting 'type'.

    However, when I apply this to a treepanel and call the method on getRowClass(), the tree store does not appear to have the getAncestor() method.

    I've searched the docs, but I'm not sure what I'm missing...

  2. #2
    Sencha User
    Join Date
    Nov 2007
    Posts
    31
    Vote Rating
    0
    zacware is on a distinguished road

      0  

    Default


    I am having issues with tree node. (new Ext.tree.TreeNode is not a constructor) So I am thinking the tree component might not be quite finished yet in the the current beta or perhaps the documentation is not updated yet.

  3. #3
    Sencha User
    Join Date
    Mar 2010
    Posts
    6
    Vote Rating
    0
    jamesn is on a distinguished road

      0  

    Default


    My problem is not with the tree component, but with the TreeStore component. Perhaps you are right that it is not complete, but I can see the getAncestors() method in the source code, but not in firebug when running the code above. I suspect that there is something about the TreeStore that I'm just not aware of (yet ...).

Similar Threads

  1. Dumping Cahced Treestore data
    By m@uce in forum Sencha Touch 1.x: Discussion
    Replies: 0
    Last Post: 31 Mar 2011, 9:21 AM
  2. Ext.data.TreeStore with Ext.data.LocalStorageProxy and Ext.data.ScriptTagProxy
    By agruenen in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 16 Feb 2011, 11:21 PM

Thread Participants: 1