[CLOSED] CellEditing Plugin tab key

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] CellEditing Plugin tab key

    Hi,

    Using a CellEditing plugin in a gridpanel all fields with an editor are edited when you navigate with tab key inside gridpanel.
    This is correct.

    I have a case that if row accomplish some conditions, some fields hasn't to be editable, I do it with this code in BeforeEdit listener of plugin
    onCellBeforeEdit: function (editor, e, eOpts) {
            if (SOME_CONDITION) {
                editor.cancelEdit();
                return false;
            }
    
            return true;
        }
    Up here all right.
    But it does that user can't edit next editable cell.

    Is there a way, when I determine that a cell is not editable, next editable cell is start edition?
    Last edited by Daniil; Jun 05, 2013 at 10:05 AM. Reason: [CLOSED]
  2. #2
    Hi @softmachine2011,

    I don't think you need to call an editor's cancelEdit. Returning false is enough and it doesn't break tabbing.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Store store = this.GridPanel1.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] { "test1", "test2", "test3" },
                    new object[] { "test4", "test5", "test6" },
                    new object[] { "test7", "test8", "test9" }
                };
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:GridPanel ID="GridPanel1" runat="server">
                <Store>
                    <ext:Store runat="server">
                        <Model>
                            <ext:Model runat="server">
                                <Fields>
                                    <ext:ModelField Name="test1" />
                                    <ext:ModelField Name="test2" />
                                    <ext:ModelField Name="test3" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
                <ColumnModel runat="server">
                    <Columns>
                        <ext:Column runat="server" Text="Test1" DataIndex="test1">
                            <Editor>
                                <ext:TextField runat="server" />
                            </Editor>
                        </ext:Column>
                        <ext:Column runat="server" Text="Test2" DataIndex="test2">
                            <Editor>
                                <ext:TextField runat="server" />
                            </Editor>
                        </ext:Column>
                        <ext:Column runat="server" Text="Test3" DataIndex="test3">
                            <Editor>
                                <ext:TextField runat="server" />
                            </Editor>
                        </ext:Column>
                    </Columns>
                </ColumnModel>
                <Plugins>
                    <ext:CellEditing runat="server">
                        <Listeners>
                            <BeforeEdit Handler="if (e.colIdx === 1) { return false; }" />
                        </Listeners>
                    </ext:CellEditing>
                </Plugins>
            </ext:GridPanel>
        </form>
    </body>
    </html>
  3. #3
    Well, with your sample I can navigate with tab key, only double click to edit the first and third column.

    This is my problem, with return false, tab doesn't goes on from first to third column, only works from third to first column.
    How can avoid this?

    Tested in Ext.NET 2.1 r4377
  4. #4
    Please always specify Ext.NET version you are on. Especially, if it is not the latest public release or SVN trunk.

    I can confirm it is reproducible with v2.1. But it is not with v2.2 and SVN trunk.

    So, it was a bug and has been fixed.
    Last edited by Baidaly; May 31, 2013 at 9:49 PM.
  5. #5
    Quote Originally Posted by Daniil View Post
    Please always specify Ext.NET version you are on. Especially, if it is not the latest public release or SVN trunk.

    I can confirm it is reproducible with v2.1. But it is not with v2.2 and SVN trunk.

    So, it was a big and has been fixed.
    Well, and could you tell me what's the fix or where I can find it to apply it to my current version?
  6. #6
    It is not so simple to find out what the fix was, since Sencha fixed that, not we. I would try to diff the related classes.
  7. #7
    Ok, I will wait your answer
  8. #8
    Unfortunately, I am unable to extract a fix. You could start editing of the next cell manually, as a workaround.
  9. #9
    Ok it's allright, how can I do it?
  10. #10
    Please try this fix.

    Fix
    Ext.selection.RowModel.override({
        onEditorTab: function(editingPlugin, e) {
            var me = this,
                view = me.views[0],
                record = editingPlugin.getActiveRecord(),
                header = editingPlugin.getActiveColumn(),
                position = view.getPosition(record, header),
                direction = e.shiftKey ? 'left' : 'right',
                columnHeader;
    
            // We want to continue looping while:
            // 1) We have a valid position
            // 2) There is no editor at that position
            // 3) There is an editor, but editing has been cancelled (veto event)
    
            do {
                position  = view.walkCells(position, direction, e, me.preventWrap);
                columnHeader = view.headerCt.items.getAt(position.column);
            } while (position && (!columnHeader.getEditor(record) || !editingPlugin.startEditByPosition(position)));
        }    
    });
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 5
    Last Post: Sep 20, 2017, 12:23 AM
  2. CellEditing plugin requires TablePanel
    By yash.kapoor in forum 2.x Help
    Replies: 3
    Last Post: Apr 22, 2016, 1:04 PM
  3. Replies: 1
    Last Post: Jan 18, 2013, 2:11 AM
  4. [CLOSED] V2.1 CellEditing validate
    By Aurelio in forum 2.x Legacy Premium Help
    Replies: 12
    Last Post: Dec 29, 2012, 8:34 AM
  5. [CLOSED] CellEditing plugin
    By Kev in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Sep 13, 2012, 8:06 PM

Tags for this Thread

Posting Permissions