1. #1
    Sencha User
    Join Date
    Jan 2012
    Location
    New York City
    Posts
    109
    Answers
    1
    Vote Rating
    2
    infernoz is on a distinguished road

      0  

    Default 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:

    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
            })
    ......
    ......
        ],
    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:

    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)

    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
            })
        ],
    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.

    Thanks,

    infernoz

  2. 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
    }]

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


    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
    ________________
    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.

  4. #3
    Sencha User
    Join Date
    Jan 2012
    Location
    New York City
    Posts
    109
    Answers
    1
    Vote Rating
    2
    infernoz is on a distinguished road

      0  

    Default 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. #4
    Sencha User
    Join Date
    Jan 2012
    Location
    New York City
    Posts
    109
    Answers
    1
    Vote Rating
    2
    infernoz is on a distinguished road

      0  

    Default


    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

  6. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,073
    Answers
    3500
    Vote Rating
    854
    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


    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
    ________________
    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.

  7. #6
    Sencha User
    Join Date
    Jan 2012
    Location
    New York City
    Posts
    109
    Answers
    1
    Vote Rating
    2
    infernoz is on a distinguished road

      0  

    Default


    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

  8. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,073
    Answers
    3500
    Vote Rating
    854
    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


    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
    ________________
    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.

  9. #8
    Sencha User
    Join Date
    Jan 2012
    Location
    New York City
    Posts
    109
    Answers
    1
    Vote Rating
    2
    infernoz is on a distinguished road

      0  

    Default


    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?

  10. #9
    Sencha User carol.ext's Avatar
    Join Date
    Jun 2007
    Location
    Littleton, Colorado, USA
    Posts
    673
    Answers
    16
    Vote Rating
    20
    carol.ext will become famous soon enough carol.ext will become famous soon enough

      0  

    Default


    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
    }]

  11. #10
    Sencha User
    Join Date
    Jan 2012
    Location
    New York City
    Posts
    109
    Answers
    1
    Vote Rating
    2
    infernoz is on a distinguished road

      0  

    Default


    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