1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    India
    Posts
    180
    Answers
    1
    Vote Rating
    -5
    AtulDawkhare can only hope to improve

      0  

    Default Unanswered: Grid with Edit Delete image , needs to hide after click

    Unanswered: Grid with Edit Delete image , needs to hide after click


    Hi
    I have Grid with Row editor. and in the action column I have logic for Edit and Delete the row.

    Now my requirement is , when user clicks on Edit image ,

    1] image should get hide
    2] Row editor should gets enabled.

    I am able to achieved this. Here is the code for that
    Code:
    {
            xtype: 'actioncolumn',
            width: 80,
            items: 
                [ 
                    {
                        icon   : 'images/new/icon/edit.png', 
                        handler: function(grid, rowIndex, colIndex) 
                        { 
                            var rec = grid.getStore().getAt(rowIndex);
                            grid.getStore().getAt(rowIndex).set('closed', 1);
                            grid.addRowCls(grid.getNode(rowIndex),'line-through'); 
                            var rec = Store.getAt(rowIndex); 
                            rowEditing.cancelEdit();
                            rowEditing.startEdit(rec, 0);},
                            style:'margin-left:5px',
                            getClass: function(value,metadata,record)
                                { 
                                    var closed = record.get('closed'); 
                                    if (closed == 1 ) 
                                    {
                                        return 'x-hide-display';
                                    }
                                    else 
                                    {
                                        return 'x-grid-center-icon';
                                    }
                                } 
                    }, 
                    {
                        icon   : 'images/new/icon/delete.png', 
                        handler: function(grid, rowIndex, colIndex) 
                        {
                            var rec = Store.getAt(rowIndex); 
                            var idx= Store.indexOf(rec);
                            delete(parent,idx);
                        }
                    }
                ]
    }
    Now as the row editor is enabled , user has ONLY 2 options
    1] click on update
    2] click on cancel

    a.jpg

    My Queries are

    1] In both the case I want to enabled the image for that row. [which I have hide/ disabled]
    2] I want to know that is it possible to enabled the row editor only on edit image click, rather than clicking on row?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,620
    Answers
    3452
    Vote Rating
    817
    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


    I wonder if you can set clicksToEdit to zero and if that would stop the editor from appearing by tapping on the row.
    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.

  3. #3
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Answers
    102
    Vote Rating
    77
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    the proper way of doing it is listening to the beforeedit event, inspect the column. If it's an action column, then prevent the edit from taking place.

  4. #4
    Sencha User
    Join Date
    Aug 2011
    Location
    India
    Posts
    180
    Answers
    1
    Vote Rating
    -5
    AtulDawkhare can only hope to improve

      0  

    Default


    Thank you so much for the reply.

    It is not working even if I made the clicksToEdit to 0. I guess it will work using the listener, let me try it out

    Can you please tell me how can i enabled the image , which I have disabled?

    I want to know how can I get Action column when the control is in row editor part.