PDA

View Full Version : Grid, display updatet store, after response



tfcoding
24 Jul 2010, 7:33 AM
Hi,

i have a problem by understanding to solve a problem.

I have a JsonStore and want to fill it with data after a form is submitted in a grid, the response is working fine (also the display of the data when i fill the store at startup but this is not what i want to do)

My Problem is now, after the grid is rendered, i get the right json response from the server but i dont know how to react on the new data of the store.

The Grid

xtype: 'grid',
store: 'researchStore',
height: 278,
ref: '../../artikelGrid',
autoRef: 'artikelGrid',
itemId:'artikelGrid',
id:'artikelGrid',
loadMask:true,
scope:this,
sm: new Ext.grid.RowSelectionModel({
singleSelect:false,
listeners:{
rowselect:{
fn:function (sm,index,record){
dataTemplate.update(record.data);
}
}
}
}),
columns: [.....

My Store


researchStore = Ext.extend(Ext.data.JsonStore, {
constructor: function(cfg) {
cfg = cfg || {};
researchStore.superclass.constructor.call(this, Ext.apply({
storeId: 'researchStore'
,scope:this
,proxy:glato
,reader:glatoReader
,root:'art'
,idProperty:'Artikel'
,batch:true
,fields:[
'Aktenzeichen'
,'Artikel'
,{name:'Artikel',mapping:'Artikel'}
,{name:'Aktenzeichen',mapping:'Aktenzeichen'}
,{name:'Headline',mapping:'Headline'}
,{name:'SubTitel',mapping:'SubTitel'}
,{name:'Entscheidung',mapping:'Entscheidung'}
,{name:'Ziffer',mapping:'Ziffer'}
,{name:'Jahr',mapping:'Jahr'}
,{name:'TextFeld',mapping:'TextFeld'}]
//,autoLoad:true
}, cfg));
}
});


My Form Submitt method


var seek = function(){


this.searchForm.getForm().submit({


success:function(f,a){

Ext.Msg.alert("Success", a.result.successmessage);

},
failure: function(f,a) {
Ext.Msg.alert('Fail',a.result.errormsg);


},waitMsg:'Fetching...'

});

}

Could anybody give me a hint or a advice to solve my problem

tfcoding
24 Jul 2010, 9:26 AM
Ok, i have found a not so clean and nice way to solve the problem but i can live with it...

To get and submit the field "volltext" i use this for example




this.artikelGrid.getStore().load({
params: {
volltext: document.getElementById('volltext').value
}});

Condor
25 Jul 2010, 5:21 AM
I would return the grid data in the form success response and use:

success: function(form, action){
this.artikelGrid.getStore().loadData(action.result);
},
scope: this

tfcoding
30 Jul 2010, 11:00 PM
Thank you :)

Problem is solved