PDA

View Full Version : Problem writing my own grid feature



jclark42796
22 Feb 2012, 6:30 AM
As a starting point to understanding and possibly writing my own grid feature, I started w/ the Ext.grid.feature.GroupingSummary. I copied the code into my own js file and modified the define/namespace and alias.



Ext.define('Myapp.feature.GroupingSummary',{
alias: 'feature.myappgroupingsummary',
.....


In my grid code I do this:



//this.features = Ext.create('Ext.grid.feature.GroupingSummary',{ // THIS LINE WORKS
this.features = Ext.create('Myapp.feature.GroupingSummary',{ // THIS DOESN'T WORK
groupHeaderTpl: '{name}'
});


If I substitute in the creation of my feature, I get the following error:
me.summaryGroups[index-1] is undefined
name = me.summaryGroups[index-1].name,

in the case of the error, index equals 2, but the there is only one summary group. I started digging through the template code but got complicated pretty quickly.

Other than the namespace/alias change, not sure why this wouldn't work as the feature code didn't change.

Thanks,
Jim

mitchellsimoens
22 Feb 2012, 7:37 AM
Your alias is wrong... you have this:


alias: 'feature:'myappgroupingsummary'

Where it should be:


alias: 'feature.myappgroupingsummary'

jclark42796
22 Feb 2012, 7:46 AM
Thanks for looking at this. Actually, that was a typo on my part in the forum post. Code is as you described.

Jim

Tim Toady
22 Feb 2012, 9:08 AM
is



Ext.define('Myapp.feature.GroupingSummary'),{
also a typo? You shouldn't have that right paren there.

jclark42796
22 Feb 2012, 10:03 AM
arg! yes, sorry. (Based on my configuration, this had to be retyped vs. copy/paste)