[CLOSED] RowExpander click also puts row into edit mode using RowEditing plugin

  1. #1

    [CLOSED] RowExpander click also puts row into edit mode using RowEditing plugin

    I am having a problem with an application that uses RowEditing and RowExpander together
    I have included other posts suggestions - but am still having problems.

    I'm created an example using GridPanel=>Update=>Restful as a base

    I am editing the rows inline using RowEditing plugin
    I added another plugin RowExpander to trigger the display of history for the row.

    Clicking once on one of the row fields correctly puts the row into edit mode; set ClicksToEdit(1)

    Clicking once on the "+" for expander row opens the row
    1) Problem - even though ExpandOnDblClick(true) - expands on single click
    2) Row goes into edit mode and expander displays history
    3) Expander hides the [Update][Cancel] buttons

    I also added a command column to trigger editing along with clicking the row
    1) command column does not react to a single click
    2) clicking on it twice puts it into "expand" mode instead of edit mode

    I have tried several variations on this combination but the two plugins seemed linked.
    I think I need these two items addressed:
    1) Having the command column take one click to go into edit mode
    2) Prevent the row going into edit mode when the "+" for the row expander has been pressed.

    I've attached the controller and cshtml file
    The important snips are:
    .ColumnModel(Html.X().CommandColumn().Commands(c => c.Add(Html.X().GridCommand().CommandName("edit").Icon(Icon.Pencil)))
                                                                 .Listeners(listener => { listener.Command.Handler = "commandHandler(edit,  record);"; }),
    
    .Plugins(
                 Html.X().RowExpander().ID("reHistory").ExpandOnDblClick(true)
                                   .Loader(Html.X().ComponentLoader()
                                                    .Url(Url.Action("GetTestPersonTestHistory"))
                                                    .Mode(LoadMode.Component)
                                                    .LoadMask(mask => mask.ShowMask = true)
                                                    .Params(new { id = JRawValue.From("this.record.data.Id") })
                                            )
                                            ,
                    Html.X().RowEditing().ClicksToEdit(1).ClicksToMoveEditor(1)
                        .Listeners(l => {
                            l.CancelEdit.Handler = "if(e.record.phantom){e.store.remove(e.record);}";
                        })
                                
                )
    Thanks! Cyndi Pruett
    Attached Files
    Last edited by Daniil; Mar 14, 2014 at 8:25 AM. Reason: Please use [CODE] tags, [CLOSED]
  2. #2
    Hi @cynsystems,

    Welcome to the Ext.NET forums!

    It is much clearer and simpler to discuss the only issue per thread.

    So, in this thread let's consider the first one. For all the others please start individual threads.

    Clicking once on the "+" for expander row opens the row1) Problem - even though ExpandOnDblClick(true) - expands on single click
    The ExpandOnDblClick setting doesn't affect the "+/-" icon.

    For your requirement I can suggest the following solution. The key part in the ColumnModel's Add listener.

    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[] { "test", "test" },
                    new object[] { "test", "test" },
                    new object[] { "test", "test" }
                };
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    
        <script>
            var onAdd = function(headerContainer, column) {
                if (column.isExpanderColumn) {
                    column.processEvent = function (type, view, cell, rowIndex, cellIndex, e, record) {
                        if (type == "dblclick" && e.getTarget('.x-grid-row-expander')) {
                            var rowExpander = this.grid.getRowExpander();
    
                            rowExpander.toggleRow(rowIndex, record);
                            return rowExpander.selectRowOnExpand;
                        }
                    }
                }   
            };
        </script>
    </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" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
                <ColumnModel runat="server">
                    <Columns>
                        <ext:Column runat="server" Text="Test 1" DataIndex="test1" />
                        <ext:Column runat="server" Text="Test 2" DataIndex="test2" />
                    </Columns>
                    <Listeners>
                        <Add Fn="onAdd" />
                    </Listeners>
                </ColumnModel>
                <Plugins>
                    <ext:RowExpander runat="server" />
                </Plugins>
            </ext:GridPanel>
        </form>
    </body>
    </html>

Similar Threads

  1. Replies: 3
    Last Post: Oct 11, 2013, 10:28 PM
  2. [CLOSED] RowEditing plugin customization
    By bayoglu in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: May 03, 2013, 5:28 PM
  3. RowEditing Plugin Not working
    By GKG4 in forum 2.x Help
    Replies: 2
    Last Post: Apr 27, 2013, 6:49 PM
  4. [CLOSED] About the rowEditing plugin.
    By feanor91 in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 10, 2012, 11:31 AM
  5. Replies: 4
    Last Post: Jan 28, 2011, 9:55 AM

Tags for this Thread

Posting Permissions