PDA

View Full Version : Problem with tree panel.



super.rotus
7 Feb 2014, 9:45 AM
I've read a lot of complains with the treepanel, and i myself having some troubles with this,

The first of all is that I found in other post, that treegrid doesnt have the paging working correctly, so i found some solutin that doesnt work and i will try to make it work for everybody.

The other and this is where i need some help is that when I expand a parent node, it make the call to the server and display the children correctly, but when i collapse and then expand it again it will paint the same child twice, and then the tree crashes, it show this error.

Uncaught TypeError: Cannot read property 'internalId' of undefined


After working on it I discover that the problem is not what it insert it again, but in the beforeitemexpand function,it just append twice the same child, and it makes that the js and the treestore contains 2 same nodes with the same internalId and crashes.

Any ides?
regards

scottmartin
7 Feb 2014, 10:44 AM
What version of Ext4 are you using?

You would need to provide more information. This error can be due to duplicate id?

super.rotus
7 Feb 2014, 11:17 AM
What version of Ext4 are you using?

You would need to provide more information. This error can be due to duplicate id?

Hey scottmartin, is extjs 4.1 and maybe is that problem, the problem is that i dont have the same json file as used in treestore, my json is:

[{"tipoOperacion":null,"servicioProcesar":"001119","servAfore":"0480","fechaPaquete":null,"fechaInicio":null,"fechaFin":null,"loteAfore":"0","status":"Terminado","horaInicioTrans":"10:48:28","horaFinTrans":null,"totalRecProcesar":"1","totalRecS336":"0","totalARecS336":"null","aceptadosBus":"1","confirmadosS336":"1","confirmadosProcesar":"0","timeout":"0","enProblema":"0","totalLotPendiente":null,"totalLotRecibido":"null","totalLotEnviado":"null","pendEnviarProcesar":"null","pendEnviarS336":"0","folioPaquete":"001119201157990000000001109002","pendRecProcesar":null,"pendRecS336":null,"esperaRespuesta":"0","rechazadosS336":"0","rechazadosProcesar":"0","rechazadosBus":"0","rechazadosTimeout":"0","folioAfore":"null","folioProcesar":"null","idError":"null","idProcess":"null","indicador":"null","packageType":"Entrada","appS336NoActiva":"0","s336Duplicado":"0","s336Package":"0","s336ServerNoActive":"0","serviceOperationDescription":"NOTIFICACIÓN SOLICITUD DE SALDO PREVIO","servicioOpetracionS336":"0480","folioLote":"null","leaf":"false","sq":"1"},

I dont have the json control, it is formed at a webservice,
so the first time i display the items, it displays ok, the second time it display it twice but doesnt make the call to the ajax.

The parent node is called by ajax after a button click,
then the leafs are called to an other store.load with the same structure...
my store looks like this.


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


root: {
text: '',
draggable: false, // disable root node dragging
attributes:{

},
autoLoad:false,
expanded: true,
children: [

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

autoload:false ,
autoSync: false


} ,listeners: {
beforeload: function(store, operation, eOpts){ //this will be called after clickin the expand button



var kode_jabatan = operation.node.get("folioPaquete");
operation.params.packageId = kode_jabatan;




}
}


});

super.rotus
7 Feb 2014, 11:48 AM
Is there a way to set differnet id to everynode?, i know the estructure should be:["item1":{"tipoOperacion":null,"servicioProcesar":"001119","servAfore":"0480"," },but I cant do that with my json, so i think i can use the beforeitemappend event, so i set different internalId to every node...

super.rotus
7 Feb 2014, 3:46 PM
Any idea?
Regards.