PDA

View Full Version : Multiple calls during Store.load() - Possible Bug ?



balajiratnam
13 Sep 2007, 5:05 AM
I have a form to retrive a particular record "Find" button on the toolbar is clicked. This displays a list of records in a grid, the user selects a particular record by double clicking it.

On double clicking, the form makes a call via Store.load using HttpProxy and XMLReader to the server.

The first time this is done, correctly one single call is made to load data.

If "Find" is clicked again and another record is selected, logically another call should be made to retrieve the selected record but in FireBug I see 2 calls being made.

The calls being made keep adding up on each subsequent retrieval.

the variable to define the form is global in the .js and no subsequent rendering takes place after the first load.

Please see attached images and suggest what could be the issue.

I have seen the thread http://extjs.com/forum/showthread.php?t=3877
but in my case there is no re-rendering

This is the function that retrieves the record after selecting it from the "Find" grid:


function countryMasterAction (action, recCode) {
var countryMasterRecordDef = Ext.data.Record.create([
{name: 'recCode'},
{name: 'theName'},
{name: 'activeFlag'}
]);
var countryMasterProxy = new Ext.data.HttpProxy({url: '/pages/webBL/countryMaster_WS.aspx?action='+action+'&recCode='+recCode});
var countryMasterStore = new Ext.data.Store({
proxy: countryMasterProxy,
reader: new Ext.data.XmlReader ({
record: 'countryMaster',
id: 'recCode'
}, countryMasterRecordDef),
remoteSort: false
});

countryMasterStore.load();
countryMasterStore.on ('load', function () {
form_countryMaster.reset();

form_countryMaster.items.get('theName').setValue(countryMasterStore.getAt(0).data['theName']);
form_countryMaster.items.get('activeFlag').setValue(countryMasterStore.getAt(0).data['activeFlag']);

form_action='edit';
form_recCode=countryMasterStore.getAt(0).data['recCode'];
});
}