Hybrid View

  1. #1
    Sencha User
    Join Date
    Nov 2008
    Posts
    3
    Vote Rating
    1
    andrekpl is on a distinguished road

      1  

    Default Unanswered: Custom CellEditor - CompleteEdit on blur

    Unanswered: Custom CellEditor - CompleteEdit on blur


    Hi!
    I have a custom cell editor for a grid, say the htmleditor. (It's not but has the same issue).
    When clicking outside the grid while editing a cell, the cell editor is not closed.
    I tried to use the blur event but w/o success (too many components in htmleditor can have the focus, I guess).
    Any idea how to trigger the completeEdit event?

    See code at http://jsfiddle.net/rC6Q7/

    Thanks for any hint
    andre

    Code:
    Ext.onReady(function() {
        Ext.create('Ext.data.Store', {
            storeId: 'simpsonsStore',
            fields: ['name'],
            data: {
                'items': [{
                    "name": "Lisa"
                }, {
                    "name": "Bart"
                }, {
                    "name": "Homer"
                }, {
                    "name": "Marge"
                }]
            },
            proxy: {
                type: 'memory',
                reader: {
                    type: 'json',
                    root: 'items'
                }
            }
        });
    
    
        Ext.create('Ext.grid.Panel', {
            title: 'Simpsons',
            store: Ext.data.StoreManager.lookup('simpsonsStore'),
            columns: [{
                header: 'Name',
                dataIndex: 'name',
              flex: 1,
                editor: 'htmleditor'
            }],
            selType: 'cellmodel',
            plugins: [
            Ext.create('Ext.grid.plugin.CellEditing', {
                clicksToEdit: 1
            })],
            height: 200,
            width: 400,
            renderTo: Ext.getBody()
        });
    });

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,010
    Answers
    668
    Vote Rating
    460
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Why would you want to place such a heavy component in the place of an editor in a grid cell?
    I would really look for an alternative solution ..

    If you must, then I would recommend having a look at:
    http://skirtlesden.com/ux/component-column

    It allows components to be placed in cells.

    Scott.

  3. #3
    Sencha User
    Join Date
    Nov 2008
    Posts
    3
    Vote Rating
    1
    andrekpl is on a distinguished road

      0  

    Default


    Thanks Scott, that's what I'm currently doing, but it's not the preferred solution.
    What I'm trying to build is a kind of a property grid. Some properties are not just primitives, e.g. 2x2 grids or rich texts. And it would be better for usability if all properties can be edited in place, not just some.

    It's not the issue to display a complex custom cell editor. The issue is to hide it when it looses focus.

    andre

  4. #4
    Sencha Premium Member
    Join Date
    Mar 2011
    Posts
    29
    Vote Rating
    0
    indreshms is on a distinguished road

      0  

    Default


    Facing the same issue as well. I am able to show the editor get/set the value. But the editor does not go off when I click elsewhere on the grid!

  5. #5
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,010
    Answers
    668
    Vote Rating
    460
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Have you seen property grid?
    http://dev.sencha.com/deploy/ext-4.1.../property.html

    My approach would be to have a button or actioncolumn to display a popup for the html editor.

    @indreshms, are you using an editor?

    Scott.

  6. #6
    Sencha Premium Member
    Join Date
    Mar 2011
    Posts
    29
    Vote Rating
    0
    indreshms is on a distinguished road

      0  

    Default


    Scott. Yes I am using a custom cell editor (in my case it is a field container which in turn has a text field and a button). While debugging I found that the cell editing plugin will wait for a "blur" event from the editor and react to the event by hiding the editor. Since I am using a field container (which cannot be directly focused), I had to re-route the textfield's "blur" event. Now the editor goes of.

    But now I have an additional problem to solve. Since field container is not a focusable entity, the plugin wont call focus! Any help?

    Thanks

  7. #7
    Sencha User
    Join Date
    Mar 2014
    Posts
    14
    Answers
    1
    Vote Rating
    0
    george4buxton is on a distinguished road

      0  

    Default


    I've posted an answer that creates an interceptor on a specific button instance's onMouseDown method (the mousedown event *not* being exposed) on SO: http://stackoverflow.com/q/23504280/34806