-
19 Aug 2011 12:04 AM #1
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 :
in GroupingSummary.js at printData function. Does anyone know what causes this problem ? It is just simple configuration of model and store. Any suggestions?Code:me.summaryGroups[index - 1] is undefined
-
19 Aug 2011 12:14 AM #2
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
-
19 Aug 2011 12:26 AM #3
Thanks, for your answer. No, that´s of course not my problem. I´ll try to post example code later the day.
-
19 Aug 2011 12:51 AM #4
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.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); }
Thanks 4 help
-
19 Aug 2011 1:52 AM #5
sorry but it seems like you have an issue anywhere else in your code.
follow works:
after that, execute "store.getGroupData()" in firebug. You get the right outputCode:<!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>
-
19 Aug 2011 3:22 AM #6
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
-
19 Aug 2011 3:59 AM #7
thats interesting but without more code i could not help anymore.
maybe you can try something like this:
I am not 100% sure but i think this only works if you have a controller that loads both store and model.Code:Ext.define('WST.store.ReservationItem', { model: 'ReservationItem', ................. }); Ext.create('Ext.grid.Panel', { store: 'ReservationItem', ....... });
also try using root property of memory proxy.


Reply With Quote