PDA

View Full Version : Please help! problem with tree grid!



super.rotus
4 Feb 2014, 2:20 PM
I have this problem, and I just can't find how to fix it:

I drawing a tree grid (treepanel) and it only paints the folder icon, but no information of every node, can anyone help me??

Here is the code and an example of the json response!

Regards.
store:

var store=Ext.create('Ext.data.TreeStore', { model: 'IE.model.seguimiento.packageTracking',



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



} ,

autoload:false ,
autoSync: false


}
});

Model:


Ext.define('IE.model.seguimiento.packageTracking', { extend: 'Ext.data.Model',
alias: 'widget.packageTrackingModel',
config: {
fields: [{name:'tipoOperacion',type:'string' } ,
{name:'servicioProcesar',type:'string'},
{name:'servAfore',type:'string'},
{name:'fechaPaquete',type:'string'},
{name:'fechaInicio',type:'string'},
{name:'fechaFin',type:'string'},
{name:'loteAfore',type:'string'},
{name:'status',type:'string'},
{name:'horaInicioTrans',type:'string'},
{name:'horaFinTrans',type:'string'},
{name:'totalRecProcesar',type:'string'},
{name:'totalRecS336',type:'string'},
{name:'totalARecS336',type:'string'},
{name:'aceptadosBus',type:'string'},
{name:'confirmadosS336',type:'string'},
{name:'confirmadosProcesar',type:'string'},
{name:'timeout',type:'string'},
{name:'enProblema',type:'string'},
{name:'totalLotPendiente',type:'string'},
{name:'totalLotRecibido',type:'string'},
{name:'totalLotEnviado',type:'string'},
{name:'pendEnviarProcesar',type:'string'},
{name:'pendEnviarS336',type:'string'},
{name:'pendRecProcesar',type:'string'},
{name:'pendRecS336',type:'string'},
{name:'esperaRespuesta',type:'string'},
{name:'rechazadosS336',type:'string'},
{name:'rechazadosProcesar',type:'string'},
{name:'rechazadosBus',type:'string'},
{name:'rechazadosTimeout',type:'string'},
{name:'folioAfore',type:'string'},
{name:'folioProcesar',type:'string'},
{name:'idError',type:'string'},
{name:'pendRecS336',type:'string'},
{name:'idProcess',type:'string'},
{name:'indicador',type:'string'},
{name:'packageType',type:'string' },
{name:'appS336NoActiva',type:'string'},
{name:'s336Duplicado',type:'string'},
{name:'s336Package',type:'string'},
{name:'s336ServerNoActive',type:'string'},
{name:'serviceOperationDescription',type:'string'},
{name:'sq',type:'string'},
{name:'folioPaquete',type:'string'},
{name:'folioLote',type:'string'} ]
}
});




My treepanel:

{ xtype : 'treepanel',
itemId : 'gridPackageD',
width : 700,
height : 260,
x : 5,
y : 50,
margin : '0 40 20 15',
autoScroll : true,
columnLines : true,

sortableColumns: false,
title: 'Consulta' ,
store:store,
rootVisible :false,
root:'',

columns : [ {
xtype: 'treecolumn',
text : 'Tipo Paquete',
dataIndex : 'packageType'
},{

text:'Folio Paquete',
dataIndex:'folioPaquete'

},
{
text : 'Servicio Procesar',
dataIndex : 'servicioProcesar',
width : 130
}, {
text : 'Servicio Afore',
dataIndex : 'servAfore',
width : 75,
style : 'text-align:center'
}, {
text : 'SQ',
dataIndex : 'sq',
width : 60,
style : 'text-align:center'
},{
text : 'Folio Lote',
dataIndex : 'folioLote',
renderer: function(value, metaData, record, row, col, store, gridView){
if(value=='null'){
return '';
}
return value;
},


width : 120,
style : 'text-align:center'
},{
text : 'Fecha',
dataIndex : 'fechaInicio',
width : 70,
style : 'text-align:center'
},{
text : 'Lotes Afore',
dataIndex : 'loteAfore',
width : 70,
style : 'text-align:center'
}, {
text : 'Estatus',
dataIndex : 'status',
width : 60,
style : 'text-align:center'
}, {
text : 'Hora Inicio Transferencia',
dataIndex : 'horaInicioTrans',
width : 60,
style : 'text-align:center'
}, {
text : 'Hora Fin Transferencia',
dataIndex : 'horaFinTrans',
width : 60,
style : 'text-align:center'
}, {
text : 'Total Recibidos de Procesar',
dataIndex : 'totalRecProcesar',
width : 130,
style : 'text-align:center'
}, {
text : 'Total Recibidos de S336',
dataIndex : 'totalRecS336',
width : 130,
style : 'text-align:center'
}, {
text : 'Total a Recibir de S336',
dataIndex : 'totalARecS336',
width : 130,
style : 'text-align:center'
}, {
text : 'Aceptados por Bus',
dataIndex : 'aceptadosBus',
width : 60,
style : 'text-align:center'
}, {
text : 'Confirmados por S336',
dataIndex : 'confirmadosS336',
width : 120,
style : 'text-align:center'
}, {
text : 'Confirmados por Procesar',
dataIndex : 'confirmadosProcesar',
width : 120,
style : 'text-align:center'
}, {
text : 'Timeout',
dataIndex : 'timeout',
width : 60,
style : 'text-align:center'
}, {
text : 'En Problemas',
dataIndex : 'enProblema',
width : 60,
style : 'text-align:center'
}, {
text : 'Total',
dataIndex : 'total',
width : 60,
style : 'text-align:center'
}, {
text : 'Pendiente de enviar a S336',
dataIndex : 'pendEnviarS336',
width : 160,
style : 'text-align:center'
}, {
text : 'En Problemas',
dataIndex : 'enProblema',
width : 60,
style : 'text-align:center'
}, {
text : 'En Espera de Respuesta',
dataIndex : 'esperaRespuesta',
width : 60,
style : 'text-align:center'
}, {
text : 'Rechazos de S336',
dataIndex : 'rechazadosS336',
width : 60,
style : 'text-align:center'
}, {
text : 'Rechazos de Procesar',
dataIndex : 'rechazadosProcesar',
width : 60,
style : 'text-align:center'
}, {
text : 'Pendiente',
dataIndex : 'total',
width : 60,
style : 'text-align:center'
}, {
text : 'Total Rechazados por bus',
dataIndex : 'rechazadosBus',
width : 60,
style : 'text-align:center'
} , {
text : 'Descripción',
dataIndex : 'serviceOperationDescription',
width : 120,
style : 'text-align:center'
}
]

And the json response:

[{"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"},{"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":"001119201157992310000001109002","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"}

Please please help me! thanks

scottmartin
4 Feb 2014, 2:36 PM
Do you have control over the return json? Why no root?

super.rotus
4 Feb 2014, 2:43 PM
Do you have control over the return json? Why no root?

Hi scottmartin and tx for the reply, the problem is that i dont own the json, its a spring transformation that transform an array of objects to json, so i cant add the root,
also the child nodes will e added after clicking the + button and not from the beginning.

scottmartin
4 Feb 2014, 2:46 PM
See if this will help: (post #9)
http://www.sencha.com/forum/showthread.php?256348

super.rotus
4 Feb 2014, 3:00 PM
See if this will help: (post #9)
http://www.sencha.com/forum/showthread.php?256348

Hey scottmartin, sorry for this, but can you help me pointing out my error?
Why does this paint the nodes but not the info?
is root really necessary?
47811

super.rotus
4 Feb 2014, 3:39 PM
See if this will help: (post #9)
http://www.sencha.com/forum/showthread.php?256348

Or maybe can i reconfigure my store to match the treestore needed?

f.baron
5 Feb 2014, 12:37 AM
It seems like the store doesn't uses the model correctly, are you sure you passed the model class name correctly? And are you sure the model class works? Why do you use 'config' around the 'field' property?

super.rotus
5 Feb 2014, 8:16 AM
It seems like the store doesn't uses the model correctly, are you sure you passed the model class name correctly? And are you sure the model class works? Why do you use 'config' around the 'field' property?

Hey f.baron!, you were freaking figh!! the model wasnt visible for the js! I moved it to the view and wala! it all seems ok, now i have to make the tree load after clicking a button...

super.rotus
5 Feb 2014, 8:41 AM
I'm trying this way... but the store doesnt load... any idea?


Treestore:




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



root: {
text: '',
id: 'packageType',


autoLoad:false,
expanded: false,
children: [
]},
proxy: {
type: 'ajax',
api: {
read: 'packageTracking/findPackages'
},
reader: {
type: 'json'
},

autoload:false ,
autoSync: false


}
});



My treepanel:


xtype : 'treepanel', itemId : 'gridPackageD',
id:'gridPackageD',
width : 700,
height : 260,
x : 5,
y : 50,
margin : '0 40 20 15',
autoScroll : true,
columnLines : true,

sortableColumns: false,
title: 'Consulta' ,
store:{type:'PackageTrackingGrid'}, ...

and the controller:





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) {
//grid.getStore().setRootNode(grid.getStore().getRootNode());
alert('caalback'+records);



it doesnt make the load... the alert ('calback') bring me nothing... someone? please

super.rotus
5 Feb 2014, 8:56 AM
So, i realize that it wasnt aplying the
store:{type:'store'}


so i modify my code, so it first call the store, then aply to the treestore, now it is called, but is doesnt show anything... any advice


var store=Ext.create('store.PackageTrackingGrid');

if(idService.value!=null){

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

console.log('status:'+success);
if(success==false){
Ext.Msg.alert('Error','Ocurrió un error el sistema, favor de avisar al administrador');
}
}

});
Ext.apply(grid, {
store: store
});

super.rotus
5 Feb 2014, 10:58 AM
I finally make this work...I have another situation:When you click the expand button of the node it load the data (from the server) and thats perfect, but then i click again the button and it reload the data, how can i correct this?