PDA

View Full Version : Problem with store on load function



kushal
22 Oct 2007, 7:53 AM
I have three combo boxes.
The value of the third combo box populates depending on the query fired by the values of the first two combo boxes. A query gets fired each time the value of the first two combo box are changed.
When the combined values return an empty json i show a message. The problem i am facing is that each time i change the value of the combo box and get and empty JSON the error messages are appended i.e. for every time I get an empty JSON the error messages are appended showing me error messages those many number of times.
As in the example the number of alerts increments each time i get an empty JSON.
Using HTTP proxy to get the JSON response for the third combo box.
Any reasons.



<code> if(cmbSupJobTitle.getValue==null || cmbSupDepartment.getValue()==null || cmbSupJobTitle.getValue()=='' || cmbSupDepartment.getValue()==''){alert('empty combo boxes');}else{
storeSuperior.load({params:{supJobTitle: cmbSupJobTitle.getValue(), supDepartment: cmbSupDepartment.getValue()}});
storeSuperior.on('load',function(){
if(storeSuperior.getTotalCount()==0){
alert("No Employee exists with the selected combination of Department and Job Title!");

}else{
var index = storeSuperior.find('name',objBean.employeeList[0].superior);
var rec = storeSuperior.getAt(index);
if(rec == null){
cmbSuperior.setValue(objBean.employeeList[0].superior);
}else{
var hiddenValue = rec.get('pid');
cmbSuperior.setValue(hiddenValue);
}
}
},this);
} </code>