vendredi 27 juin 2014

4.2.2 Form and Grid Best Practice

Hi,

I have a form and a grid on a Panel together. The form is a search criteria filter for the grid.


What is the best practice to handle the submission of the form which should reload the grid? I decided to handle the event in the View's controller since I need to access the grid's store. - Is this correct?


The issue I'm having is how, do I reload the grid's store with the response received by the search filter?



Code:



init: function() {
var me = this;
//me.application.on('searchForClients', me.performSearchForClients);

this.control({ 'button[name="searchForClients"]': {
click: function(){
var form = this.getSearchForClients().up('form').getForm();
if (form.isValid()) {
form.submit({
url: '/TGT/rest/clients/searchForClients.json',
method: 'GET',
waitMsg: 'Searching Please Wait...',
success: function(form, action) {
var test = action.result;
var clientStore = Ext.data.StoreManager.lookup('clientStore');
clientStore.load(action.result);
},
failure: function(form, action) {
Ext.Msg.alert('Client Search Error', 'Error searching for clients, please contact your system administrator');
}
});
}

}
}
});
},

Am I loading the data from result into the grid correctly? There is no data being displayed in the grid.


Aucun commentaire:

Enregistrer un commentaire