PDA

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



supera
Aug 15, 2012, 6:09 PM
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>

Daniil
Aug 15, 2012, 6:21 PM
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.

supera
Aug 15, 2012, 7:05 PM

Daniil
Aug 16, 2012, 4:45 AM
As I mentioned, please update from:
http://svn.ext.net/premium/branches/2.1/

supera
Aug 16, 2012, 1:08 PM
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