1. #1
    Sencha User
    Join Date
    Sep 2011
    Location
    Indonesia
    Posts
    23
    Vote Rating
    0
    hihiapolla is on a distinguished road

      0  

    Default Unanswered: Raw Data is Different with Model Data in Store

    Hi everyone,

    I am using Sencha Touch 2.1 (latest release). I have a bit of trouble with store reloading. Consider this scenario :
    1. There is a DataView when you first time login to the application. The DataView use a store that is loaded using AJAX proxy.
    2. User perform some change in the record and when the change is sent to the server (using AJAX call), we will basically reload the view (instantiate the View again with Ext.Create, reload the store).

    The problem is when we reload and instantiate the view the second time, somehow the store is never updated (it is always refer back to the first loaded data). We manage to run Inspection tool in Chrome and found that the raw data is different with the loaded model data even though we load the store twice.

    Here is the attached screenshot :

    store.PNG

    Please help to clarify this matter whether it is a bug or not? Or we are missing something? Currently I am preparing a simplified test case scenario for this matter. However any idea/solution/workaround from people that already experiencing this will be appreciated.

    Here a sample code from our application :

    - Store creation

    Code:
    //Declare store of patients in wards
            this._storePatientInward = new Ext.data.Store({
                model: 'Apps_EMOS_IPad.model.PatientInWard',
                autoLoad: false,
                autoSync: false,
                clearOnPageLoad: true,
                clearRemovedOnLoad: true,
                listeners: {
                    beforeload: function () {
                        //alert("Beforeloaded");
                        console.log("BEFORELOADED", this.getAt(0));
                    },
                    load: function () {
                        console.log("LOADED", this.getAt(0).bed());
                    }
                }
            });
    Code:
    //Fetch patients according to desired period(date)
                    var proxyPatientInWard = {
                        type: 'ajax',
                        noCache: true,
                        url: '/FrontAPI/FetchPatientInWard/?username=' + this._nurseUsername +
                                                          "&password=" + this._nursePassword + period,
                        reader: {
                            type: 'json',
                            rootProperty: 'patient_in_ward'
                        }
                    };
                    
                    this._storePatientInward.setProxy(proxyPatientInWard);
                    this._storePatientInward.load({
                        callback: function (records, operation, success) {
                            console.log("RECORDS RETRIEvED:", records);
                            //Show toolbar on top according to date
                            this._internalCreateToolbarTop(this._date);
    
    
                            //Show the list of patients
    
    
                            if (this._wards == '') {
                                // Here contains the data view that copy data from the store, since the store put wrong model data the data is never updated in the dataview here
                                this._internalCreatePanelPatientInWard();
                            } else {
                                this._internalCreatePanelPatientInWard(this._wards);
                            }
                   .............. continuing
    We are already spent around 2-3 days resolving this case. Please help !

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,546
    Vote Rating
    1120
    Answers
    3700
    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

    What is the response like?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    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.

  3. #3
    Sencha User
    Join Date
    Sep 2011
    Location
    Indonesia
    Posts
    23
    Vote Rating
    0
    hihiapolla is on a distinguished road

      0  

    Default

    The response is synchronized with the the raw data. So by right the raw data is updating the store correctly, however the changed is not reflected in the current store data retrieved (it is like loading the old data).

  4. #4
    Sencha Premium Member
    Join Date
    Oct 2013
    Posts
    434
    Vote Rating
    1
    Answers
    2
    fabioebner is on a distinguished road

      0  

    Default

    hei man.. any solution ?? i have the same problem

  5. #5
    Sencha User
    Join Date
    Oct 2014
    Posts
    51
    Vote Rating
    3
    Answers
    1
    The_Unknown is on a distinguished road

      0  

    Default

    Hey there, I have the same issue. Extremely annoying. Is there any workaround at least?