PDA

View Full Version : Problem with tree panel, treestore load and mvc



super.rotus
31 Jan 2014, 4:58 PM
Hi everyone, new in the forum, I really really need your help...

I'm using a treepanel, with mvc methodology...
My view have something like this:

{ xtype : 'treepanel',
itemId : 'gridPackageD',
width : 700,
height : 260,
x : 5,
y : 50,
margin : '0 40 20 15',
autoScroll : true,
columnLines : true,
hideHeaders : false,
sortableColumns: false,
title: 'Consulta',
store : {type:'PackageTrackingGrid'}

My store looks like this:




Ext.define('IE.store.seguimiento.packageTracking',{
extend: 'Ext.data.TreeStore',
alias: 'store.PackageTrackingGrid',
storeId: 'PackageTrackingGrid',
model: 'IE.model.seguimiento.packageTracking',

proxy: {
type: 'ajax',
api: {
read: 'packageTracking/findPackages'
},
reader: {
type: 'json',
root : Boolean
}


},

autoLoad: false,
autoSync: false
}) ;





And my controller have the following:



var store=grid.getStore();
if(idService.value!=null){

store.load({
params: {
idService: idService.value,
operationType:tipoOperacion.value,
status:estatus.value,
date:fecha.value
},
callback: function(records, operation, success) {
alert(records);
alert(operation);



It never calls the service, the problem is that when I use a grid it returns everything correctly... pls pls I need your help!
Regards!

mitchellsimoens
6 Feb 2014, 12:46 PM
You are treating a TreeStore like a regular Store. Your TreeStore needs a root node and when you expand it and it has no children it will load the data:


root : {
text : '',
expanded : true
}

If you don't want to show the root node, use the rootVisible config on the tree panel.

super.rotus
6 Feb 2014, 1:41 PM
You are treating a TreeStore like a regular Store. Your TreeStore needs a root node and when you expand it and it has no children it will load the data:


root : {
text : '',
expanded : true
}

If you don't want to show the root node, use the rootVisible config on the tree panel.

Thanks for your help mitchellsimoens, know its working, but my dooubt is the next, any idea?

Regards.

http://www.sencha.com/forum/showthread.php?280929