1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    17
    Vote Rating
    0
    sachinrathore is on a distinguished road

      0  

    Default store is not updated after the setting of a extraParams

    store is not updated after the setting of a extraParams


    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
    Pyramid1234 /samples/IHGProject/app/controller/Notes.js?_dc=1343827786453:137
    The return value is=6 /samples/IHGProject/app/controller/Notes.js?_dc=1343827786453:156





    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.



  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,608
    Vote Rating
    435
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Did you make sure txt is the correct value? I change extraParams and works for me.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Apr 2010
    Location
    China
    Posts
    227
    Vote Rating
    19
    haduki will become famous soon enough

      0  

    Default


    vipsshan is your friend?
    jsonp is async request.
    Your should do this:
    Code:
    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");
        }
    });