1. #1
    Sencha User
    Join Date
    Sep 2010
    Location
    Germany
    Posts
    53
    Answers
    2
    Vote Rating
    2
    HTK is on a distinguished road

      0  

    Default Unanswered: Ext 4.0.2a MemoryProxy with grouping feature

    Unanswered: Ext 4.0.2a MemoryProxy with grouping feature


    Hi! I have written simple code for a model with no associations or validations. If I create a store now, which has summary grouping feature and a memory proxy I get an error while adding a new model instance to my store. He throws :
    Code:
    me.summaryGroups[index - 1] is undefined
    in GroupingSummary.js at printData function. Does anyone know what causes this problem ? It is just simple configuration of model and store. Any suggestions?

  2. #2
    Sencha User
    Join Date
    Sep 2009
    Posts
    85
    Answers
    8
    Vote Rating
    -1
    raz0r1 is an unknown quantity at this point

      0  

    Default


    next time please post a line number and a small example code so someone who wants to help does have less work to find what you meen.

    your problem:
    it seems like you are not defining any groups in your store:
    http://docs.sencha.com/ext-js/4-0/#/...thod-getGroups

  3. #3
    Sencha User
    Join Date
    Sep 2010
    Location
    Germany
    Posts
    53
    Answers
    2
    Vote Rating
    2
    HTK is on a distinguished road

      0  

    Default


    Thanks, for your answer. No, that´s of course not my problem. I´ll try to post example code later the day.

  4. #4
    Sencha User
    Join Date
    Sep 2010
    Location
    Germany
    Posts
    53
    Answers
    2
    Vote Rating
    2
    HTK is on a distinguished road

      0  

    Default


    Code:
    Ext.define('WST.model.ReservationItem', {
        extend: 'Ext.data.Model',
        fields: [
            { name: 'id', type: 'int', useNull: true },
            { name: 'reservationId', type: 'int', useNull: true },
            { name: 'itemId', type: 'int', useNull: true },
            { name: 'itemType', type: 'string', useNull: true },
            { name: 'name', type: 'string' },
            { name: 'personName', type: 'string' },
            { name: 'personNumber', type: 'int', useNull: true },
            { name: 'count', type: 'int' },
            { name: 'price', type: 'float' }
        ]
    });
    // grid store
    store: Ext.create('Ext.data.Store', {
        model: 'WST.model.ReservationItem',
        data: [],
        proxy: {
            type: 'memory',
            reader: {
                type: 'json'
            }
        },
        groupField: 'personName'
    })
    
    for (i = 0; i < 4; i++) {
                    var record = Ext.create('WST.model.ReservationItem', {
                        'personName': i
                    });
                    store.add(record);
                }
    I also tried initial data in the store. If I add records in a loop. For example 3 records. The first 2 get added. The last throws the error. And like I said. The error is thrown in GroupingSummary.js on line 162.

    Thanks 4 help

  5. #5
    Sencha User
    Join Date
    Sep 2009
    Posts
    85
    Answers
    8
    Vote Rating
    -1
    raz0r1 is an unknown quantity at this point

      0  

    Default


    sorry but it seems like you have an issue anywhere else in your code.
    follow works:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    <link rel="stylesheet" href="extjs/resources/css/ext-all.css" />
    <script type="text/javascript" src="extjs/ext-all-debug.js"></script>
    <script type="text/javascript">
    var store;
    Ext.onReady(function(){
        Ext.define('WST.model.ReservationItem', {
            extend: 'Ext.data.Model',
            fields: [
                { name: 'id', type: 'int', useNull: true },
                { name: 'reservationId', type: 'int', useNull: true },
                { name: 'itemId', type: 'int', useNull: true },
                { name: 'itemType', type: 'string', useNull: true },
                { name: 'name', type: 'string' },
                { name: 'personName', type: 'string' },
                { name: 'personNumber', type: 'int', useNull: true },
                { name: 'count', type: 'int' },
                { name: 'price', type: 'float' }
            ]
        });
        // grid store
        store = Ext.create('Ext.data.Store', {
            model: 'WST.model.ReservationItem',
            data: [],
            proxy: {
                type: 'memory',
                reader: {
                    type: 'json'
                }
            },
            groupField: 'personName'
        });
    
    
        
        for (i = 0; i < 4; i++) {
                        var record = Ext.create('WST.model.ReservationItem', {
                            'personName': i
                        });
                        store.add(record);
    
    
    
    
    }});</script>
    </head>
    <body></body>
    </html>
    after that, execute "store.getGroupData()" in firebug. You get the right output

  6. #6
    Sencha User
    Join Date
    Sep 2010
    Location
    Germany
    Posts
    53
    Answers
    2
    Vote Rating
    2
    HTK is on a distinguished road

      0  

    Default


    I´ve found out that my records miss the index property. When I create a JSON Object and add that via store.loadData(record) it works and my records have an index property. I cannot see the reason for that behaviour

  7. #7
    Sencha User
    Join Date
    Sep 2009
    Posts
    85
    Answers
    8
    Vote Rating
    -1
    raz0r1 is an unknown quantity at this point

      0  

    Default


    thats interesting but without more code i could not help anymore.

    maybe you can try something like this:
    Code:
    Ext.define('WST.store.ReservationItem', {
    model: 'ReservationItem',
    .................
    });
    
    Ext.create('Ext.grid.Panel', {
    store: 'ReservationItem',
    .......
    });
    I am not 100% sure but i think this only works if you have a controller that loads both store and model.

    also try using root property of memory proxy.

Thread Participants: 1