PDA

View Full Version : Ext.ux.maximgb.tg.EditorGridPanel dynamic problems



Cindy Azcha
19 Jan 2011, 2:51 PM
hi all, I've been looking for help for many web pages try to EXT, because in Spanish did not find much to turn to you.
I hope I understand through pictures what I am trying to do:

24365

The window for selection of the children is equal
24366,

I show the code I did for each grid:

main grid


// belonging to my main grid

var record = Ext.data.Record.create([
{name:'IDpresupuesto'},
{name: 'codigo'},
{name: 'descripcion'},
{name: 'unidad'},
{name: 'metrado'},
{name: 'precio1'},
{name: 'precio'},
{name: 'parcial'},
{name: '_id',type: 'int'},
{name: '_parent', type: 'auto'},
{name: '_is_leaf', type: 'bool'}

]);
var store = new Ext.ux.maximgb.tg.AdjacencyListStore({
proxy : new Ext.data.HttpProxy ({
method : 'GET',
url : '../class/clsReportepresupuesto.php'
}),
reader: new Ext.data.JsonReader(
{
id: '_id',
root: 'dataReporta',
totalProperty: 'total',
successProperty: 'success'
},
record
),
listener : {
'beforeload' : function (){
this.baseParams.start = 0;
this.baseParams.limit = 0;
}
}
});


// create the Grid
this.grid = new Ext.ux.maximgb.tg.EditorGridPanel({
id : 'grid_det_presu',
store: store,
// mode:'local',
master_column_id : 'codigo',
columns: [
{header:'Codigo', id: 'codigo', dataIndex:'codigo',sortable: true, fixed : true, width : 70},
{header:'Descripción', id: 'col_descripcion', dataIndex:'descripcion',sortable: true},
{header:'Unidad', dataIndex:'unidad',sortable: true},
{header:'Metrado', dataIndex:'metrado',sortable: true, summaryType:'sum',
editor: new Ext.form.NumberField({
allowBlank: false,
allowNegative: false,
style: 'text-align:left'
})},
// {...}
],
stripeRows: true,
autoExpandColumn: 'col_descripcion',
title: 'Presupuesto de Obra',
bbar: new Ext.ux.maximgb.tg.PagingToolbar({
store: store,
displayInfo: true,
pageSize: 30
}),
sm:new Ext.grid.RowSelectionModel({singleSelect:true}),//esta parte fue modificada
});
grid node


//grid for selection of node

var recordNodo = Ext.data.Record.create([
{name:'IDpresupuesto'},
{name: 'codigo'},
{name: 'descripcion'},
{name: 'unidad'},
{name: 'metrado'},
{name: 'precio1'},
{name: 'precio'},
{name: 'parcial'},
{name: '_id',type: 'int'},
{name: '_parent', type: 'auto'},
{name: '_is_leaf', type: 'bool'}

]);

{
text:'spell',iconCls:'spell-icon',id:'selecciona',
scope:this,
handler: function () {
var seleccionado = Ext.getCmp('gridTitulo').getSelectionModel().getSelected(); //indice seleccionado
if(Ext.getCmp('gridTitulo').getSelectionModel().hasSelection() ){
Ext.each( Ext.getCmp('gridTitulo').getSelectionModel().getSelections(), function (record) {
if ( Ext.getCmp ('grid_det_presu').getStore().getById ( record.id ) == null){
var NodoTitulo = new recordNodo({
IDpresupuesto: 0,
codigo : record.data.cod_titulo,
descripcion : record.data.descripcion,
unidad : null,
metrado : null,
precio1 : null,
precio : null,
parcial : null,
_id : record.data.cod_titulo,
_parent : null,
_is_leaf : true//false
});

Ext.getCmp('grid_det_presu').store.add(NodoTitulo);
}
});
}
}

}
child grid



//grid for selection of child

var recordNodo = Ext.data.Record.create([
{name:'IDpresupuesto'},
{name: 'codigo'},
{name: 'descripcion'},
{name: 'unidad'},
{name: 'metrado'},
{name: 'precio1'},
{name: 'precio'},
{name: 'parcial'},
{name: '_id',type: 'int'},
{name: '_parent', type: 'auto'},
{name: '_is_leaf', type: 'bool'}
]);

{
text:'spell',iconCls:'spell-icon',id:'selecciona',
scope:this,
handler: function () {
if(Ext.getCmp('gridPartida').getSelectionModel().hasSelection() ){
Ext.each( Ext.getCmp('gridPartida').getSelectionModel().getSelections(), function (record) {
if ( Ext.getCmp ('grid_det_presu').getStore().getById ( record.id ) == null){
var NodoPartida = new recordNodo({
IDpresupuesto: 0,
codigo : record.data.cod_Partida,
descripcion : record.data.descripcion,
unidad : null,
metrado : null,
precio1 : null,
precio : null,
parcial : null,
_id : Ext.id(),// Ext.getCmp('grid_det_presu').getSelectionModel().getSelected().data.codigo+'.'+record.data.cod_Partida+'.'+Ext.getCmp('grid_det_presu').getSelectionModel().getSelected().data.codigo,
_parent : Ext.getCmp('grid_det_presu').getSelectionModel().getSelected().data.codigo,
_is_leaf : true
});

var r = Ext.getCmp('grid_det_presu').getSelectionModel().getSelected();
r.set("_is_leaf", false); r.set ("_is_leaf", false);


Ext.getCmp('grid_det_presu').store.commitChanges();
Ext.getCmp('grid_det_presu').store.addSorted(NodoPartida);
Ext.getCmp('grid_det_presu').store.expandNode(r);
Ext.getCmp('grid_det_presu').getView().refresh();

}
});
}
}
}
please help, adding the normal node is added to my main grid, but when added to the children they appear already issued:

24369

y alli queda todo, no me permite realizar ninguna otra operación y en firebug no me reporta error.

help please