PDA

View Full Version : Problem with Ext.tree.Panel



JEMF
19 Nov 2013, 3:46 PM
Hello guys,

I'm trying to get the Source and Target node in a TreePanel but I'm not sure what to do. This is what I have...



Ext.define('Ext_data_Model_Categorias', {
extend: 'Ext.data.Model',
fields:
[
{ name: 'idcategoria', type: 'int', useNull: false },
{ name: 'categoria', type: 'string', useNull: false }
]
});


var Ext_Data_TreeStore_Categorias = Ext.create
(
'Ext.data.TreeStore',
{
model: Ext_data_Model_Categorias,
proxy:
{
type: 'ajax',
url: categorias.json',
}
}
);


var Ext_tree_Panel_Categorias = Ext.create
(
'Ext.tree.Panel',
{
columns:
[
{
dataIndex: 'idcategoria',
text: 'Id',
width: 50
},
{
dataIndex: 'categoria',
flex: 1,
sortable: true,
text: 'Categoria',
xtype: 'treecolumn'
}
],
frame: true,
rootVisible: false,
store: Ext_Data_TreeStore_Categorias,
title: 'Categorias de productos',
viewConfig:
{
listeners:
{
render: function()
{

console.log(this.up('treepanel').getView().scroller);
}
},
plugins:
{
containerScroll: true,
ptype: 'treeviewdragdrop'
}
}
}
);


categorias.json


{"text":".","children":[{"idcategoria":"194","categoria":"Sexo","checked":false,"children":[{"idcategoria":"1263","categoria":"Alimentos y comestibles er\u00f3ticos","checked":false,"leaf":true},{"idcategoria":"1264","categoria":"Juegos er\u00f3ticos","checked":false,"leaf":true},{"idcategoria":"1265","categoria":"Juguetes sexuales","checked":false,"leaf":true},{"idcategoria":"1266","categoria":"Kits de baile de barra americana","checked":false,"leaf":true},{"idcategoria":"1267","categoria":"Lencer\u00eda er\u00f3tica","checked":false,"leaf":true},{"idcategoria":"1268","categoria":"Libros er\u00f3ticos","checked":false,"children":[{"idcategoria":"3438","categoria":"C\u00f3mics er\u00f3ticos","checked":false,"leaf":true}]},{"idcategoria":"1269","categoria":"Revistas er\u00f3ticas","checked":false,"leaf":true},{"idcategoria":"1270","categoria":"V\u00eddeos y DVD er\u00f3ticos","checked":false,"leaf":true}]}]}

scottmartin
22 Nov 2013, 8:57 PM
Please see the following:

1ou