PDA

View Full Version : grid reconfigure



beita
19 Aug 2008, 1:47 AM
Hello,

First, i'm sorry to my english level because i don't know a lot of english, but i have some questions about ext framework.

The fist question is the correct use of the "reconfigure" method. I have a grid panel, when any row is selected i do one ajax request and after i would like reconfigure the data store of my grid with the new data but i don't know how i can do it.

Please i need help..... ;) thanks.

Condor
19 Aug 2008, 1:49 AM
You don't need to reconfigure the grid for new data. Simply load the store (optionally with different parameters).

reconfigure() is only needed when the fields and/or the columns change.

Sandrine
19 Aug 2008, 1:52 AM
Hi,

me i used :
-if the store changes :
Ext.getCmp("mygrid_id").reconfigure( store, columnModel ) ;
-if just i sort the grid:
Ext.getCmp('mygrid_id').getStore().reload({params:'genre=livre'});

Bye
Sandrine

beita
19 Aug 2008, 2:01 AM
oh thanls for all but i cant do it, could you write any example for that, i write a example to my grid:

crearLaTabla: function () {
this.tabla = new Ext.grid.GridPanel({
store: this.dataStore,
columns: [
{id:this.identificadorColumnaDatos,header: this.titularDeLaTabla, width: 160, sortable: true, dataIndex: this.identificadorDataStore},
],
stripeRows: true,
autoExpandColumn: this.identificadorColumnaDatos,
collapsed: false,
hideHeaders:true,
});
},


thanks again.

Sandrine
19 Aug 2008, 2:07 AM
In first I created my grid like you and when I clik on a button I reconfigure my grid :

store = new Ext.data.Store({
url: "blabla/myfile.xml",
reader: new Ext.data.XmlReader({
record: 'Items',
id: 'id',
totalRecords: 'total'
},
tab_reader
)
});
Ext.getCmp("mygrid_id").reconfigure( store, columnModel ) ;
store.load();

beita
19 Aug 2008, 2:18 AM
ok, and what is columnModel???

Sandrine
19 Aug 2008, 2:24 AM
It's like your :

columns: [
{id:this.identificadorColumnaDatos,header: this.titularDeLaTabla, width: 160, sortable: true, dataIndex: this.identificadorDataStore},
],

Mine is :
var columnModel = new Ext.grid.ColumnModel([{id: 'ref', header: 'Reference', sortable: true, dataIndex: 'ref'},{header: 'Designation', sortable: true, dataIndex: 'designation'},{header: 'Genre', sortable: true, dataIndex: 'genre'}]);

It's to reload the name of columns
I hope it helps you

beita
19 Aug 2008, 4:31 AM
thanks for all, it's ok. finally i've used the load method:

creaElDataStore: function (identificadorDataStore) {
this.dataStore = new Ext.data.SimpleStore({
fields: [
{name: identificadorDataStore},
]
});
},
cargaElDataStore: function (datosDeLaTabla) {
this.dataStore.loadData(datosDeLaTabla);
}

and it's right,

Thanks....