1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    14
    Vote Rating
    0
    chiragrp is on a distinguished road

      0  

    Default Inconsistent plugins in ExtJS 4

    Inconsistent plugins in ExtJS 4


    Hi,

    I have used tow plugins for GridPanel. One is Ext.grid.plugin.CellEditing and the other is Ext.ux.RowExpander.

    When creating GridPanel, I could specify CellEditing plugin as following:
    plugins: [
    Ext.create('Ext.grid.plugin.CellEditing', {
    clicksToEdit: 1
    })
    ]
    I could not specify the RowExpander plugin in the same manner since it needs reference of the GridPanel instance.

    My questions is that are there any reasons to have such inconsistent plugins?

    Thanks

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,603
    Vote Rating
    325
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    I'm not sure what you mean. The RowExpander should be just the same, you shouldn't need a reference to the grid.

    Take a look at the code for the demo:

    http://dev.sencha.com/deploy/ext-4.0...d-plugins.html

  3. #3
    Sencha User
    Join Date
    Dec 2011
    Posts
    14
    Vote Rating
    0
    chiragrp is on a distinguished road

      0  

    Default


    The difference is that in case of CellEditing plugin, you can create an instance of the plugin and set it as config option for the GridPanel whereas in case of RowExpander it is not possible.
    See the code below:

    a) CellEditing:
    Code:
    plugins: [
    Ext.create('Ext.grid.plugin.CellEditing', {
    clicksToEdit: 1
    })
    ]
    b) RowExpander:
    Code:
    plugins: [{
                ptype: 'rowexpander',            rowBodyTpl : [                '<p><b>Company:</b> {company}</p><br>',                '<p><b>Summary:</b> {desc}</p>'            ]         }]
    
    I hope example above is conveying what I want to say.

    Thanks
    Chirag

  4. #4
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,603
    Vote Rating
    325
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    I think I see what you mean. RowExpander needs the grid to be set in the constructor whereas CellEditing only needs it to be set by init time.

    The first thing to note is that RowExpander is a UX so you should expect it to be less tidy than a proper part of the framework. I agree it would be better if you could create it separately using Ext.create.

    There's a comment in the source of RowExpander that explain why it needs the grid at construction time. It's relying on the grid features mechanism and apparently that must be done before the plugin's init method is called.

    The preferred method for creating plugins is to use the config-style. For CellEditing you should really be writing something like this:

    Code:
    plugins: [{
        ptype: 'cellediting',
        clicksToEdit: 1
    }]

  5. #5
    Sencha User
    Join Date
    Dec 2011
    Posts
    14
    Vote Rating
    0
    chiragrp is on a distinguished road

      0  

    Default


    I see your point.

    Thanks

Thread Participants: 1

Tags for this Thread