lundi 17 novembre 2014

Refreshing grid problems

After three days digging this forum and google I've got not solution to my problem yet.

For short:


window->grid & form


window is bound to vievmodel defines as:



Code:



Ext.define('GesVol.view.editor.PageEditorModel',{
alias: 'viewmodel.editor_model'
,data: { paginaCorrente: null }
,extend: 'Ext.app.ViewModel'
,stores: {
pagine: {
model: 'GesVol.model.Pagine',
autoLoad: true,
session: true
}
}
});


  1. double clicking a row open a form for editing

  2. user update fields and save the form

  3. grid becomes dirty

  4. user repeat step 1 as many times he wants

  5. user click save grid button

  6. a direct call to server method update mysql db and respond with success

  7. here the problem: how to reload/reconfigure/refresh/repaint this damned grid?


Before direct call I've tried to use store.sync(...) BUT there is no way to pass additionaly parameters.

On my node.js server I use only one method for CRUD operation that require the table name .


I've tried with "params", "extraParams" in every possibile combination (model, store, proxy ...). The framework simply cut everything and pass only id and the value of the updated cells.


So I've got no other choice to use the direct call like this:


from ViewController:



Code:



,onElencoSalvaClick: function( btn, eOpts ) {
var me = this,
grid = this.lookupReference('elenco_pagine'),
store = grid.getStore(),
data = {
table: 'pagine',
records: []
};


store.getUpdatedRecords().forEach( function(rec) {
data.records.push( rec.getData() );
});

ExtRemote.DXAll.update(data, function( result, event ) {
if( result.success ) {
<how refresh the grid here ?>
toastr.success('Aggiornamento pagina sito effettuato');
} else {
GesVol.app.getController('Main').doError(result,event);
}
});
}

For "refresh" I mean something that can clean the dirty flag of cells.

Note that cells already have the correct values.

I've tried:



Code:



grid.refresh()
...
grid.getView().refresh()
...
grid.getView().refreshView()
...
store.reload({ callback: function() { any combination above ... })
...
some vodoo ...

I use ext 5.0.1.1255.

I MUST end this project for my thesis in few days.


Please help!






Refreshing grid problems

Aucun commentaire:

Enregistrer un commentaire