Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    13
    Vote Rating
    0
    rainierwolfcastle is on a distinguished road

      0  

    Default [ST 2.1.0-b2] two stores, same model: store items get overwritten (memory proxy)

    [ST 2.1.0-b2] two stores, same model: store items get overwritten (memory proxy)


    REQUIRED INFORMATION


    Ext version tested:
    • Sencha Touch 2.1.0-beta3
    • Sencha Touch 2.1.0-beta2
    • Sencha Touch 2.0.1.1
    • Sencha Touch 2.0.1 (works!)
    Browser versions tested against:
    • Chrome 21.0.1180.83 (Windows)
    Description:
    • two stores get created, based on the same model. items of the store which was created first, get partially overwritten
    • The problem does NOT occur in ST 2.0.1
    Steps to reproduce the problem:
    • Create a complex model (see example below)
    • create two JSON-Strings
    • create two stores (with storeId) which load the JSON-Strings via a memory proxy
    • When app is running, click "Get data" to create Store No. 1
    • Click "Show Data" and check the console output
    • Click "Get Data 2" to create Store No. 2
    • Click "Show Data" again and check the console output
    The result that was expected:
    • Two stores
    • Store 1 contains data of string 1
    • Store 2 contains data of string 2
    The result that occurs instead:
    • When store No. 2 is created, some content of store No. 1 is overwritten
    • If there are for example 4 items in store No. 1 and there are 3 items in store No. 2, the fourth item in store No. 1 remains the same.
    Test Case:
    Code:
          
    Ext.define('simplestore027test.model.valueModel', {
        extend: 'Ext.data.Model',
        
        config: {
            idProperty : 'QUERY_NAME',
            hasOne : [
                {
                    model          : 'simplestore027test.model.TXT_SYMBOLSModel',
                    name           : 'TXT_SYMBOLS',
                    associationKey : 'TXT_SYMBOLS'
                }             
            ]             
        }
    });
    
    
    
    
    Ext.define('simplestore027test.model.TXT_SYMBOLSModel', {
        extend : 'Ext.data.Model',
        config : {
            
            
            hasMany : [
                {
                    model          : 'simplestore027test.model.RRWS_S_TEXT_SYMBOLSModel',
                    name           : 'RRWS_S_TEXT_SYMBOLS',
                    associationKey : 'RRWS_S_TEXT_SYMBOLS'
                }
            ]
            
            
        }
    });
    
    
    
    
    Ext.define('simplestore027test.model.RRWS_S_TEXT_SYMBOLSModel', {
        extend : 'Ext.data.Model',
        config : {
            idProperty : 'SYM_NAME',
            fields     : [
                'SYM_NAME',
                'SYM_VALUE'
            ]
        }
    });
    
    
    
    
    
    
    Ext.define("simplestore027test.view.Main", {
        extend: "Ext.Container",
        requires: [
            'Ext.TitleBar',
            'Ext.data.Store'
        ],
        alias: "widget.mainview",
        config: {
            layout: {
                fullscreen: true,
                type: 'fit'
            },
            items: [{
                xtype: "titlebar",
                title: "Web Service Test",
                docked: "top",
                items: [
                    
                    {
                        xtype: "button",
                        text: 'Get Data',
                        ui: 'action',
                        itemId: "getDataButton"
                    },
                    {
                        xtype: "button",
                        text: 'Get Data 2',
                        ui: 'action',
                        itemId: "getData2Button"
                    },
                    
                    { xtype: 'spacer' },
                    {
                        xtype: "button",
                        text: 'Show Data',
                        ui: 'action',
                        itemId: "showDataButton"
                    }
                    
                ]
            },
            {
                html: [
                
                '<h1>2.0.1</h1>',
                "<p>...</p>"
            ].join("")
                
                
            }],
            listeners: [{
                delegate: "#getDataButton",
                event: "tap",
                fn: "onGetDataButtonTap",
                
            },
            {
                delegate: "#getData2Button",
                event: "tap",
                fn: "onGetData2ButtonTap",
                
            },
            {
                delegate: "#showDataButton",
                event: "tap",
                fn: "onShowDataButtonTap",
                
            }
            ]
        },
        
        
        
         onGetDataButtonTap: function () {
            console.log("getDataCommand");
    
    
                var jsonTestString =
             
             
                {
                    "values": {
                        "QUERY_NAME": "FirstQuery",
                        "TXT_SYMBOLS": {
                            "RRWS_S_TEXT_SYMBOLS": [
                                {
                                    "SYM_NAME": "AUTHOR",
                                    "SYM_VALUE": "DocBrown"
                                },
                                {
                                    "SYM_NAME": "REPTNAME",
                                    "SYM_VALUE": "QRY01_CLIENT_COST_SALES"
                                },
                                {
                                    "SYM_NAME": "REPTXTLG",
                                    "SYM_VALUE": "qry01_client_cost_sales"
                                },
                                {
                                    "SYM_NAME": "USER",
                                    "SYM_VALUE": "Einstein"
                                }              
                            ]
                        }    
                    }
                    
                    
                }
            
            
    
    
            var store = Ext.create('Ext.data.Store', {
                model: 'simplestore027test.model.valueModel',
                data: jsonTestString,
                
                storeId: 'loadedQueriesStore'
                    ,
                
                proxy: {
                    type   : 'memory',
                    reader: {
                        
                        type:'json',
                        rootProperty:'values'                                     
                    }    
                }
    
    
            });
            
            
            
        },
        
        onGetData2ButtonTap: function () {
            console.log("getData2Command");
              
            var jsonTestString =
             
             
                {
                    "values": {
                        "QUERY_NAME": "SecondQuery",
                        "TXT_SYMBOLS": {
                            "RRWS_S_TEXT_SYMBOLS": [
                                {
                                    "SYM_NAME": "AUTHOR",
                                    "SYM_VALUE": "MartyMcFly"
                                },
                                {
                                    "SYM_NAME": "REPTNAME",
                                    "SYM_VALUE": "QRY02_Whatever"
                                },
                                {
                                    "SYM_NAME": "REPTXTLG",
                                    "SYM_VALUE": "qry02_whatever"
                                }              
                            ]
                        }    
                    }
                    
                    
                }
            
            var store = Ext.create('Ext.data.Store', {
                model: 'simplestore027test.model.valueModel',
                data: jsonTestString,
                
                storeId: 'helperQueriesStore',
                
                proxy: {
                    type   : 'memory',
                    reader: {
                        
                        type:'json',
                        rootProperty:'values'                                     
                    }    
                }
                
            });
            
        },
        
        onShowDataButtonTap: function () {
            console.log("showDataCommand");
    
    
            
            var loadedQueriesStore = Ext.getStore('loadedQueriesStore');    
            console.log("loadedQueriesStore");
            console.log(loadedQueriesStore);
            
            
            var helperQueriesStore = Ext.getStore('helperQueriesStore');    
            console.log("helperQueriesStore");
            console.log(helperQueriesStore);
            
    
    
            if (loadedQueriesStore){
            
    
    
                console.log("----    loadedQueriesStore");
                var qry01 = loadedQueriesStore.getAt(0);
                   
                if (qry01)
                {
                console.log(qry01);
                var TXT_SYMBOLS  = qry01.getTXT_SYMBOLSModel().RRWS_S_TEXT_SYMBOLS();
                console.log('technical name: ');
                console.log(TXT_SYMBOLS.getById('REPTNAME').get('SYM_VALUE'));
                }
                
                
            }
             
            if (helperQueriesStore){
            
                console.log("----    helperQueriesStore");
                var qry01 = helperQueriesStore.getAt(0);
                   
                if (qry01)
                {
                console.log(qry01);
                var TXT_SYMBOLS  = qry01.getTXT_SYMBOLSModel().RRWS_S_TEXT_SYMBOLS();
                console.log('technischer Name: ');
                console.log(TXT_SYMBOLS.getById('REPTNAME').get('SYM_VALUE'));
                }
                  
            }
    
    
        }
        
    });



    HELPFUL INFORMATION


    Screenshot or Video:
    • attached
    • Description of screenshot: Store No. 1 (loadedQueriesStore) after Creation of Store No. 2 (helperQueryStore)
    • There should be DocBrown instead of MartyMcFly

    See this URL for live test case: http:// Debugging already done:
    • none
    Possible fix:
    • not provided
    Additional CSS used:
    • only default css
    Operating System:
    • Windows 7 Pro 64
    Attached Images

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,522
    Vote Rating
    814
    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


    Your test case isn't running for me. You don't need to have a controller and view and such... just console out things and run code.
    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.

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    13
    Vote Rating
    0
    rainierwolfcastle is on a distinguished road

      0  

    Default


    see next Post

  4. #4
    Sencha User
    Join Date
    Jul 2012
    Posts
    13
    Vote Rating
    0
    rainierwolfcastle is on a distinguished road

      0  

    Default


    I changed the code above and tested it in ST 2.0.1, 2.0.1.1, 2.1.0-b2.
    It only works in ST 2.0.1

  5. #5
    Sencha User
    Join Date
    Jul 2012
    Posts
    13
    Vote Rating
    0
    rainierwolfcastle is on a distinguished road

      0  

    Default


    still something missing?

  6. #6
    Sencha User
    Join Date
    Jul 2012
    Posts
    13
    Vote Rating
    0
    rainierwolfcastle is on a distinguished road

      0  

    Default


    Okay, again. Why is this still on INFOREQ?? Do you need any more information to reproduce this?

  7. #7
    Sencha User
    Join Date
    Jul 2012
    Posts
    13
    Vote Rating
    0
    rainierwolfcastle is on a distinguished road

      0  

    Default


    Okay, again. Why is this still on INFOREQ?? Do you need any more information to reproduce this?

  8. #8
    Sencha User
    Join Date
    Jul 2012
    Posts
    13
    Vote Rating
    0
    rainierwolfcastle is on a distinguished road

      0  

    Default


    Even tested it with ST2.1.0 beta3.
    Could someone please have a look?

  9. #9
    Sencha - Sencha Touch Dev Team Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    21
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    I'll get this over to the tracker.

  10. #10
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    9
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    Hi,

    The issue is that the associated items have an idProperty of SYM_NAME. The data that your loading into the second store loads associations with the exact same SYM_NAME but different values for other fields. When you load items with the same model and id (which you are in this case), the existing records are updated. This is not a bug in the framework.

    Let me know if this explanation helps you.

    Best,
    Tommy