PDA

View Full Version : Send one url and refresh many component content



JeromeA
6 Jan 2012, 2:50 PM
I'm very new to Sencha so i might use term incorrectly here but I'm sure you can understand what I'm trying to achieve here.

Is it possible send one url and then to be able to refresh many component on the screen. I know its feasible inside one form but let say I have one button, one grid, one form and one tab with mixed content. would it be possible to refreshed all of them based on one reposonse from the server?

To put you into context, imagine a point of sale, you have a total window, a shopping cart, and the last item panel. Then you sell one item. All those window need to be refreshed. Would that be possible?

If so, could you direct in few keywords I should look for? some example? I think i saw people talking about listener.

thanks a lot!

michaelc
6 Jan 2012, 3:01 PM
Yes - I do it all the time - there may be better methods then this but.

I will make an AJAX call then decode the response and take parts of it and load 3 or 4 separate stores from that one call.


Ext.Ajax.request({
url: '/Prototype/newProfileSearch.json',
success: function(result, request){
Ext.getCmp('countForm').hide();
var jsonResp = Ext.JSON.decode(result.responseText); // pull response back and process.
if (jsonResp.success) {
positionStore.loadData(jsonResp.positionListDataObj);
valueStore.loadData(jsonResp.specialtieValuesListDataObj);
....
valueReturned = valueStore.getRange();

var group = Ext.getCmp('regionChkGroup'); //Build chcek boxes based on groups.
for (i = 0; jsonResp.regionListDataObj.length > i; ++i) {
regionItem = jsonResp.regionListDataObj[i];
var checkbox = new Ext.form.Checkbox({
boxLabel: regionItem.REGION_DESCRIPTION,
name: regionItem.REGION_ID
});
checkbox.disable();
checkbox.setValue(true);
group.add(checkbox);
}
....

},
failure: function(){


I am positive many do a far more elegant job then I.

JeromeA
10 Jan 2012, 7:23 AM
Hi Micheal,
its too soon for me to try to implement this but at least I know its feasible.
thanks for the reply!