-
5 Mar 2012 11:52 AM #1
Answered: Same plugin on multiple panels causing issues
Answered: Same plugin on multiple panels causing issues
Hello,
I set up a GridPanel with a plugin that specifies 1 click to edit (may choose to make it more). I specified it as follows, and it works without issue:
However, when I created another GridPanel and specified the same plugin, as I would like the same functionality in both, I receive the following error when loading my application:Code:Ext.define('DMT.view.PersonGeoUnitView' ,{ extend: 'Ext.grid.Panel', alias : 'widget.personGeoUnitView', id: 'personGeoUnitView', title : 'Person Geo Unit Update', store: 'PersonGeoUnitStore', selType: 'cellmodel', plugins: [ Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }) ...... ...... ],
c is not a constructor
(?)(c=null, a=[Object { clicksToEdit=1}])Batch....6736150 (line 6662)
instantiate()ext-debug.js (line 6634)
alias()ext-debug.js (line 2448)
PersonGeoUnitView.js?_dc=1330976736457()Person...6736457 (line 11)
[IMG]chrome://firebug/content/blank.gif[/IMG] (6662 out of range 193)
Here is the second GridPanel setup (pretty similar to the first)
I tried moving the definition of Ext.grid.plugin.CellEditing to a different js file and referencing it via a global variable, but get the same error when doing this too. I could try having each panel extend a parent class which defines this plugin behavior, but I'd like to understand why this error is being thrown in the first place.Code:Ext.define('DMT.view.OrgStatisticsView' ,{ extend: 'Ext.grid.Panel', alias : 'widget.orgStatisticsView', id: 'orgStatisticsView', title : 'Organization Statistics Update', store: 'OrgStatisticsStore', selType: 'cellmodel' , plugins: [ Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }) ],
Thanks,
infernoz
-
Best Answer Posted by carol.ext
I ran into issues with a grid defined with a plugin using Ext.create when I used more than one of the grid. I ended up using the ptype to specify the plugin.
Code:plugins: [{ ptype: 'cellediting', clicksToEdit: 1 }]
-
5 Mar 2012 11:54 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
- Answers
- 3111
You shouldn't use Ext.create like that. Either use a config object or specify your plugins within a method like initComponent.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
5 Mar 2012 12:02 PM #3
Examples of config object or initComponent
Examples of config object or initComponent
Thanks for the response. Would it be possible to specify an example of setting a plugin using initComponent and using a config object so myself and others can use it for reference?
Thanks,
infernoz
-
5 Mar 2012 12:53 PM #4
Also, I copied the example which seems to be the incorrect way to doing this from the ExtJS 4 docs: http://docs.sencha.com/ext-js/4-0/#!...in.CellEditing . If this is the wrong way of adding a plugin, it may want to be changed in the docs as well.
Thanks,
Jason
-
5 Mar 2012 1:00 PM #5Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
- Answers
- 3111
Been wondering why people have been using Ext.create in the plugins. I have reported that example to get fixed, we are teaching a bad practice with that.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
5 Mar 2012 1:09 PM #6
Its referenced incorrectly here too: http://www.sencha.com/learn/the-grid-component/.
Would it be possible to show the right way of setting this up in this thread using the initComponent or config object?
Thanks,
infernoz
-
5 Mar 2012 1:14 PM #7Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
- Answers
- 3111
Relooking at it it's ok. It is using Ext.create not Ext.define so it is ok.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
5 Mar 2012 1:56 PM #8
Ok great, but why am I getting this error when I specify it as Ext.create in 2 different Panels?:
c is not a constructor
(?)(c=null, a=[Object { clicksToEdit=1}])Batch....6736150 (line 6662)
instantiate()ext-debug.js (line 6634)
alias()ext-debug.js (line 2448)
PersonGeoUnitView.js?_dc=1330976736457()Person...6736457 (line 11)
What is the alternative way of doing this so this error will not come up?
-
6 Mar 2012 2:59 PM #9
I ran into issues with a grid defined with a plugin using Ext.create when I used more than one of the grid. I ended up using the ptype to specify the plugin.
Code:plugins: [{ ptype: 'cellediting', clicksToEdit: 1 }]
-
7 Mar 2012 10:49 AM #10
Thanks carol.ext! Using the config and ptype for the plugins work on multiple panels. Would you happen to know the technical reason why the error stated above occured though? I'd like to understand the inner workings and what is wrong with using Ext.create in this context.
Thanks,
Jason


Reply With Quote