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

      0  

    Default Unanswered: how to make Synchronus loading of store after setting of extraParams

    Unanswered: how to make Synchronus loading of store after setting of extraParams


    Hi All,
    My problem is that there is not Synchronus loading of store taking place after the setting of extraParams ,
    but in my code store is loading Asynchronusly due to which I am getting outdated result instead of updated result. I want to know that is there is any function of store which can load store Synchronusly in Sencha Touch 2 ?

    Below is my Controller:

    onSubmitButton: function(btn, evt)
    {


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


    console.log(txt);
    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(); // here i want something which can load the store Synchronusly not Asynchronusly


    var nm=Ext.getStore('Login').getAt(0).get('ret');
    console.log("The return value is="+nm);


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


    },

    Please reply me..............

    Thanks.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Answers
    3542
    Vote Rating
    846
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    I would 100% stay away from a sync ajax request. The reason is your whole app will absolutely freeze, nothing will work while that request is being sent and received. It is much better to use the events or callback in an async request.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

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

Thread Participants: 1