PDA

View Full Version : store is not updated after the setting of a extraParams



sachinrathore
1 Aug 2012, 5:36 AM
Hi All,
I am not getting the updated value from store after the setting of extraParams and the whole logic is in the "OnSubmitButton" function of a controller and I had already set the extraParams in the "OnSubmitButton" function itself only, also given the load() function in the "OnSubmitButton" function and I want to print the upadated Store data in the "OnSubmitButton" function only i.e.(console.log("The return value is="+nm);) , I am not getting the updated value of nm in the session of a "OnSubmitButton" function.

Below is my controller (OnSubmitButton function ):

onSubmitButton: function(btn, evt){

var txt = Ext.ComponentQuery.query('#txt')[0].getValue();
var pwd = Ext.ComponentQuery.query('#pwd')[0].getValue();
console.log(pwd);


var jobsStore = Ext.getStore('Login');


jobsStore.getProxy().setExtraParam('Un',txt);
jobsStore.getProxy().setExtraParam('Pd',pwd);
jobsStore.load();


if(nm==1)
{
Ext.Msg.alert("Login in Successful");
this.activateLogin();
}
else{
Ext.Msg.alert("Enter the correct User Name and password");
}

},
Output is:

sharadc /samples/IHGProject/app/controller/Notes.js?_dc=1343827786453:133 (http://localhost/samples/IHGProject/app/controller/Notes.js?_dc=1343827786453)
Pyramid1234 /samples/IHGProject/app/controller/Notes.js?_dc=1343827786453:137 (http://localhost/samples/IHGProject/app/controller/Notes.js?_dc=1343827786453)
The return value is=6 /samples/IHGProject/app/controller/Notes.js?_dc=1343827786453:156 (http://localhost/samples/IHGProject/app/controller/Notes.js?_dc=1343827786453)


Resource interpreted as Script but transferred with MIME type text/html: "http://10.4.3.199/SenchaTest/Default.aspx?_dc=1343827809547&Un=sharadc&Pd=Pyramid1234&callback=Ext.data.JsonP.callback2". sencha-touch-debug.js:12619 (http://localhost/samples/IHGProject/resources/sencha-touch-debug.js)






Correct Output should be:
The return value is=1 ,

( i.e 6 is oudated value and 1 is updated value)

Please Suggest me....................
Thanks and Regards.

mitchellsimoens
3 Aug 2012, 5:19 AM
Did you make sure txt is the correct value? I change extraParams and works for me.

haduki
17 Sep 2012, 12:01 AM
vipsshan is your friend?
jsonp is async request.
Your should do this:


var loginStore=Ext.getStore('Login');
loginStore.load(function(records){
var nm=loginStore.getAt(0).get('ret');//or nm=records.getAt(0).get('ret')
if(nm==1){
Ext.Msg.alert("Login in Successful");
this.activateLogin();
}
else{
Ext.Msg.alert("Enter the correct User Name and password");
}
});