Greetings, I have aproblem with thestorein myviewdetail,I put in console mode record.data.Detalleand if itshows,but does not loadon myExt.Listinformation,thank you very muchfor the reply.
Data
Code:
{"root":[{"NumeroPedido":"0000003766","CodigoCliente":"100000","NombreCliente":"hskjdnd","NIF":"43065236","FechaDocumento":"2012-01-10","ClaseDocumento":"Ped. Venta Mostrador","Total":17.70,"Estado":"Ped. Concluido","Detalle":[{"DocumentoVenta":"0000003766","Posicion":"000010","CodigoMaterial":"000000000010000002","Material":"Prueba material de Revestimiento 01","Cantidad":"25.111","UnidadMedida":"UN","FechaReparto":"2012-01-16","CantidadConf":"1.000","FConf":"-","Total":0.0,"MotivoRechazo":"25.000","PrioridadEntrega":"03","CentroAlmacen":"0001","Lote":"0000000004"}]},{"NumeroPedido":"0000003767","CodigoCliente":"100000","NombreCliente":"hskdsnb","NIF":"43065236","FechaDocumento":"2012-01-10","ClaseDocumento":"Ped. Venta Mostrador","Total":17.70,"Estado":"Liberado","Detalle":[{"DocumentoVenta":"0000003767","Posicion":"000010","CodigoMaterial":"000000000010000002","Material":"Prueba material de Revestimiento 01","Cantidad":"25.111","UnidadMedida":"UN","FechaReparto":"2012-01-10","CantidadConf":"1.000","FConf":"-","Total":0.0,"MotivoRechazo":"25.000","PrioridadEntrega":"03","CentroAlmacen":"0001","Lote":"0000000004"},{"DocumentoVenta":"0000003767","Posicion":"000010","CodigoMaterial":"000000000010000002","Material":"Prueba material de Revestimiento 01","Cantidad":"25.111","UnidadMedida":"UN","FechaReparto":"2012-01-16","CantidadConf":"1.000","FConf":"-","Total":0.0,"MotivoRechazo":"25.000","PrioridadEntrega":"03","CentroAlmacen":"0001","Lote":"0000000004"}]}]}
Model
Code:
Ext.regModel("listaDocumentosModel", {
fields: [
{name: 'NumeroPedido', type: 'string'},
{name: 'CodigoCliente', type: 'string'},
{name: 'NombreCliente', type: 'string'},
{name: 'NIF', type: 'string'},
{name: 'FechaDocumento', type: 'string'},
{name: 'ClaseDocumento', type: 'string'},
{name: 'Total', type: 'decimal'},
{name: 'Estado', type: 'string'}
,{name: 'Detalle', convert:
function(value, record)
{
if (value)
{
if (value instanceof Array) {
return value;
} else {
return [value]; // Convert to an Array
}
}
return value;
}
}
]
});
Store
Code:
var listaDocumentosStore = new Ext.data.Store (
{
autoLoad: true,
model: 'listaDocumentosModel',
proxy:
{
id: 'listaDoc',
type: 'ajax',
url: 'data/lstCabDet.txt',
reader:
{
type: 'json',
root : 'root'
}
}
});
View Parent
Code:
var listDoc =
'<div class="materialItem">'+
'<div class="list-codigo">'+
'<span class="list-izq">Num.Pedido {NumeroPedido}</span>'+
' Cod. Cliente {CodigoCliente}'+
' NIF {NIF}'+
'<span class="list-izq">Nombre Cliente {NombreCliente}</span>'+
'</div>'+
'<div class="list-peso">'+
'<span>Clase {ClaseDocumento} Fecha {FechaDocumento}</span>'+
'<br />'+
'<span>Estado {Estado} Total {Total}</span>'+
'</div>'+
'</div>';
var lblRef = [{
xtype: 'fieldset',
defaults:
{
labelAlign: 'left',
labelWidth: '30%'
},
items: [
{
xtype: 'textfield',
label: 'Referencia',
useClearIcon: true
}]
}];
var buttonVolver = [{
ui: 'back',
text: 'Volver',
handler: function()
{
window.open("consultaDoc.html","_self");
}
},
{
xtype: 'spacer'
}
]
var dockedItems = [{
xtype: 'toolbar',
title: 'Lista de documentos',
dock: 'top',
ui: 'dark',
items: buttonVolver
}]
listaDocumentoView = Ext.extend(Ext.Panel,
{
fullscreen: true,
layout: 'card',
initComponent: function()
{
this.lDoc = new Ext.List({
id: 'listaDoc',
grouped: false,
itemTpl: listDoc,
loadingText: false,
store: listaDocumentosStore
});
this.lDoc.on('selectionchange', this.onSelect, this);
this.listaDocumentosPanel = new Ext.Panel(
{
layout: 'fit',
dockedItems: dockedItems,
items: this.lDoc,
listeners:
{
activate:
{
fn: function()
{
this.lDoc.getSelectionModel().deselectAll();
Ext.repaint();
},
scope: this
}
}
});
this.items = this.listaDocumentosPanel;
listaDocumentoView.superclass.initComponent.call(this);
},
onSelect: function(selectionmodel, records)
{
if (records[0] !== undefined)
{
var detalleDocCard = new detalleDocumento(
{
prevCard: this.listaDocumentosPanel,
record: records[0]
});
this.setActiveItem(detalleDocCard, 'slide');
}
}
});
Ext.reg('listaDocumentoView', listaDocumentoView);
View Child
Code:
var disDetDoc =
'<div>'+
'<div>'+
'<div>{DocumentoVenta}</div>'+
'<div>{Posicion}</div>'+
'<div>{CodigoMaterial}</div>'+
'<div>{Material}</div>'+
'<div>{Cantidad}</div>'+
'<div>{UnidadMedida}</div>'+
'<div>{FechaReparto}</div>'+
'<div>{CantidadConf}</div>'+
'<div>{FConf}</div>'+
'<div>{MotivoRechazo}</div>'+
'</div>'+
'</div>';
detalleDocumento = Ext.extend(Ext.Panel,
{
layout: 'card',
initComponent: function()
{
var sto = this.record.data.Detalle;
this.detalleLista = new Ext.List( {
itemTpl: disDetDoc,
store: sto
});
this.detallePanel = new Ext.Panel(
{
store: listaDocumentosStore,
scroll: true,
dockedItems: [{
xtype: 'toolbar',
dock: 'top',
title: 'Detalle documento',
items: [
{
ui: 'back',
text: 'Volver',
}]
}],
items: this.detalleLista
});
this.items = this.detallePanel;
detalleDocumento.superclass.initComponent.call(this);
}
});
Ext.reg('detalleDocumento', detalleDocumento);