Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-2276 in a recent build.
  1. #1
    Sencha User
    Join Date
    Feb 2009
    Posts
    11
    Vote Rating
    0
    sbrejeon is on a distinguished road

      0  

    Question List: store inline raw data vs inline models

    List: store inline raw data vs inline models


    before beta4 I could add inline data composed of models into a store with no problem.
    now the list still shows the right number of rows but the template is not rendered.


    NOT working anymore:
    Code:
    Ext.application({
    
    
    
    
        launch : function() {
    
    
    
    
            Ext.define('Contact', {
                extend : 'Ext.data.Model',
                config : {
                    fields : [ 'firstName', 'lastName' ]
                }
            });
    
    
    
    
            var store = Ext.create('Ext.data.Store', {
                model : 'Contact',
                data : [ Ext.create('Contact', {
                    firstName : 'Tommy',
                    lastName : 'Maintz'
                }), Ext.create('Contact', {
                    firstName : 'Rob',
                    lastName : 'Dougan'
                }), Ext.create('Contact', {
                    firstName : 'Ed',
                    lastName : 'Spencer'
                }), Ext.create('Contact', {
                    firstName : 'Jamie',
                    lastName : 'Avins'
                }), Ext.create('Contact', {
                    firstName : 'Aaron',
                    lastName : 'Conran'
                }), Ext.create('Contact', {
                    firstName : 'Dave',
                    lastName : 'Kaneda'
                }), Ext.create('Contact', {
                    firstName : 'Jacky',
                    lastName : 'Nguyen'
                }), Ext.create('Contact', {
                    firstName : 'Abraham',
                    lastName : 'Elias'
                }), Ext.create('Contact', {
                    firstName : 'Jay',
                    lastName : 'Robinson'
                }), Ext.create('Contact', {
                    firstName : 'Nigel',
                    lastName : 'White'
                }), Ext.create('Contact', {
                    firstName : 'Don',
                    lastName : 'Griffin'
                }), Ext.create('Contact', {
                    firstName : 'Nico',
                    lastName : 'Ferrero'
                }), Ext.create('Contact', {
                    firstName : 'Nicolas',
                    lastName : 'Belmonte'
                }), Ext.create('Contact', {
                    firstName : 'Jason',
                    lastName : 'Johnston'
                }) ]
            });
    
    
    
    
            Ext.create('Ext.List', {
                fullscreen : true,
                itemTpl : '<div>{firstName} <strong>{lastName}</strong></div>',
                store : store
            });
        }
    
    
    
    
    });

    working:
    Code:
    Ext.application({
    
    
    
    
        launch : function() {
    
    
    
    
            Ext.define('Contact', {
                extend : 'Ext.data.Model',
                config : {
                    fields : [ 'firstName', 'lastName' ]
                }
            });
    
    
    
    
            var store = Ext.create('Ext.data.Store', {
                model : 'Contact',
                data : [ {
                    firstName : 'Tommy',
                    lastName : 'Maintz'
                }, {
                    firstName : 'Rob',
                    lastName : 'Dougan'
                }, {
                    firstName : 'Ed',
                    lastName : 'Spencer'
                }, {
                    firstName : 'Jamie',
                    lastName : 'Avins'
                }, {
                    firstName : 'Aaron',
                    lastName : 'Conran'
                }, {
                    firstName : 'Dave',
                    lastName : 'Kaneda'
                }, {
                    firstName : 'Jacky',
                    lastName : 'Nguyen'
                }, {
                    firstName : 'Abraham',
                    lastName : 'Elias'
                }, {
                    firstName : 'Jay',
                    lastName : 'Robinson'
                }, {
                    firstName : 'Nigel',
                    lastName : 'White'
                }, {
                    firstName : 'Don',
                    lastName : 'Griffin'
                }, {
                    firstName : 'Nico',
                    lastName : 'Ferrero'
                }, {
                    firstName : 'Nicolas',
                    lastName : 'Belmonte'
                }, {
                    firstName : 'Jason',
                    lastName : 'Johnston'
                } ]
            });
    
    
    
    
            Ext.create('Ext.List', {
                fullscreen : true,
                itemTpl : '<div>{firstName} <strong>{lastName}</strong></div>',
                store : store
            });
    
    
    
    
        }
    
    
    
    
    });

    I'm just mentioning the facts. I agree that to call Ext.create makes little sense in that instance.


    Regards

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


    According to the API Docs it should be able to take an array of model instances.
    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
    Feb 2009
    Posts
    11
    Vote Rating
    0
    sbrejeon is on a distinguished road

      0  

    Default


    Thanks Mitchell.
    just for info, to the readers, it is not fixed in RC2.

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

      0  

    Default


    Thanks for the report. This has now been fixed for the next release.

  5. #5
    Sencha User
    Join Date
    Jun 2012
    Posts
    1
    Vote Rating
    0
    reinhrst is on a distinguished road

      0  

    Default My fix

    My fix


    Util the next release, this will (I think) fix the issue (on the 2.0.1.1 sdk):

    Code:
    --- a/sencha-sop/sdk/src/data/Operation.js
    +++ b/sencha-sop/sdk/src/data/Operation.js
    @@ -338,7 +338,11 @@ Ext.define('Ext.data.Operation', {
     
             for (i = 0; i < ln; i++) {
                 record = records[i];
    -            processedRecords.push(new Model(record.data, record.id, record.node));
    +            if (record.node instanceof Model) {
    +                processedRecords.push(record.node);
    +            } else {
    +                processedRecords.push(new Model(record.data, record.id));
    +            }
             }
     
             this.setRecords(processedRecords);