[CLOSED] ext:TreePanel - record.raw property is undefined to nodes in depth 1

  1. #1

    [CLOSED] ext:TreePanel - record.raw property is undefined to nodes in depth 1

    Hi!!!

    I'm working with ext:TreePanel in cliente side (javascript)...
    I'm creating some properties in nodes when I'm building treePanel.
    The properties that I created in node are represented in raw property of record of node.
    But, for nodes of first level, below of root node, (depth 1), the raw property is undefined... All others nodes, in different levels, have your raw property filled.

    What I do wrong?
    I made a little sample.

    <%@ Page Language="vb" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    
        <script type="text/javascript">
    
            Ext.onReady(function () {
    
                var contas = [{ ID: 'MailAccount1', Name: 'Mail Account 1', Default: 1 }, { ID: 'MailAccount2', Name: 'Mail Account 2', Default: 0}];
    
                var viewPort = Ext.create("Ext.net.Viewport", {
                    id: "ViewportConsole",
                    renderTo: Ext.getBody(),
                    layout: 'border'
                });
    
                var paneMsg = viewPort.add({
                    id: 'paneMsg',
                    region: 'south',
                    height: 200,
                    html: 'click in tree node to list the record.raw property of node'
                });
    
                var tree = viewPort.add({
                    itemId: 'tvpContas',
                    xtype: 'treepanel',
                    enableDD: true,
                    containerScroll: true,
                    region: 'center',
                    border: false,
                    layout: 'fit',
                    autoScroll: true,
                    rootVisible: false,
                    useArrows: true,
                    root: {
                        children: {}
                    },
                    listeners: {
                        itemclick: {
                            fn: function (tree, record) {
                                var html = '';
                                var node = this.getView().getNode(record);
    
                                html += 'Node: ' + record.data.text;
                                html += '</br>Deph: ' + record.data.depth;
                                if (record.raw != undefined) {
                                    for (prop in record.raw) {
                                        html += '<br>' + prop + ': ' + record.raw[prop];
                                    }
                                } else {
                                    html += '</br></br>raw property of record is undefined';
                                }
    
                                paneMsg.body.update(html);
                            }
                        }
                    }
                });
    
                tree.getRootNode().removeAll();
                var root = tree.getRootNode();
                var nodes = [];
    
                for (var i = 0; i < contas.length; i++) {
                    var folders = [];
                    var subFolders = [];
    
                    //carrego os nodos filhos
                    //recebidos
                    folders.push({
                        text: 'InBox',
                        itemId: contas[i].ID + '.Inbox',
                        iconCls: 'email_tree_recebidos_16',
                        leaf: true,
                        conta: contas[i],
                        idPasta: 0,
                        tipo: 1,
                        isSystemFolder: true
                    });
    
                    folders.push({
                        text: 'OutBox',
                        itemId: contas[i].ID + '.OutBox',
                        iconCls: 'email_tree_enviados_16',
                        leaf: true,
                        conta: contas[i],
                        idPasta: 0,
                        tipo: 2,
                        isSystemFolder: true
                    });
    
                    subFolders.push({
                        text: 'subfolder 1',
                        itemId: contas[i].ID + 'subfolder1',
                        leaf: false,
                        conta: contas[i],
                        idPasta: 1,
                        tipo: 1,
                        isSubFolder: true
                    });
    
                    subFolders.push({
                        text: 'subfolder 2',
                        itemId: contas[i].ID + 'subfolder2',
                        leaf: false,
                        conta: contas[i],
                        idPasta: 1,
                        tipo: 1,
                        isSubFolder: true
                    });
    
                    folders.push({
                        text: 'SubFolders',
                        itemId: contas[i].ID + '.SubFolders',
                        iconCls: 'email_tree_enviados_16',
                        children: subFolders,
                        leaf: false,
                        conta: contas[i],
                        idPasta: 1,
                        tipo: 0,
                        isFolder: true
                    });
    
                    nodes.push({
                        text: contas[i].Name,
                        itemId: "conta_" + contas[i].ID,
                        iconCls: 'email_tree_conta_16',
                        leaf: false,
                        conta: contas[i],
                        isConta: true,
                        children: folders,
                        expanded: contas[i].Default
                    });
                }
    
                root.appendChild(nodes);
    
            });
    
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        </form>
    </body>
    </html>
    Last edited by Daniil; Aug 16, 2012 at 1:11 PM. Reason: [CLOSED]
  2. #2
    Hi,

    I can't reproduce, I see the raw properties of the "depth 1" nodes are fine.

    Please update from SVN (the 2.1 branch) and re-test.
  3. #3
  4. #4
    As I mentioned, please update from:
    http://svn.ext.net/premium/branches/2.1/
  5. #5
    Hi Daniil!

    I get de source codes from SVN, uri http://svn.ext.net/premium/branches/2.1/

    Revision 4268

    Works very fine... thanks a lot

Similar Threads

  1. Replies: 0
    Last Post: Nov 16, 2011, 10:07 AM
  2. Replies: 16
    Last Post: May 26, 2011, 10:23 PM
  3. [CLOSED] Treepanel How to Highlight certain Nodes
    By dheeraj_us in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 13, 2010, 6:06 AM
  4. [CLOSED] How to apply spaces between TreePanel nodes using CSS?
    By flormariafr in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 05, 2010, 6:36 PM
  5. [CLOSED] [1.0] Setting Cls property on nodes with TreeGrid
    By tdracz in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 15, 2010, 1:23 PM

Posting Permissions