[CLOSED] [#680] Migration of TreeGrid from Ext 2.5.3 to 3.0.0

  1. #1

    [CLOSED] [#680] Migration of TreeGrid from Ext 2.5.3 to 3.0.0

    Hi,

    i have an TreeGrid with CellEditing Plugin. With Ext Version 2.5.3 it work fine, but not with Version 3.0.0.
    After migration i have two problems:

    a) contextmenu is not visible

    <Plugins>
                    <ext:CellEditing runat="server" ClicksToEdit="1">
                        <Listeners>
                            <BeforeEdit Handler="return beforeCellEditHandler(e);"></BeforeEdit>
                        </Listeners>
                    </ext:CellEditing>
                </Plugins>
                <View>
                    <ext:TreeView runat="server" StripeRows="true" TrackOver="true" >
                        <Listeners>
                            <CellContextMenu Fn="showContextMenu" StopEvent="true" />
                        </Listeners>
                        <GetRowClass Fn="getRowClass" />
                    </ext:TreeView>
                </View>
    The contextmenu will not be visible, editor starts on click event. It doesnt matter if right or left click.
    If i set the "ClicksToEdit=2" then the contextmenu will be visible.

    Is there a possibilty to change the value back to 1 with the old behavior?

    b) editingPlugin is undefined

    Also after migration i cannot use the editingPlugin for access to the record

    <ext:Column runat="server" ID="cStatus" Text="Status" DataIndex="Status" Width="100" >
                                    <Editor>
                                        <ext:ComboBox runat="server" ID="edtStatus" DisplayField="coStatus" TriggerAction="All" AllowBlank="false" ValueField="coStatus" Hidden="true">
                                            <Store>
                                                <ext:Store runat="server" ID="cboStatusStore">
                                                    <Model>
                                                        <ext:Model runat="server">
                                                            <Fields>
                                                                <ext:ModelField Name="ID" />
                                                                <ext:ModelField Name="coStatus" />
                                                            </Fields>
                                                        </ext:Model>
                                                    </Model>
                                                </ext:Store>
                                            </Store>
                                            <DirectEvents>
                                                <BeforeQuery OnEvent="cboStatus_BeforeQuery">
                                                    <ExtraParams>
                                                       <ext:Parameter Name="OTHERFIELD" Value="#{TreeGrid1}.editingPlugin.context.record.data.OTHERFIELD" Mode="Raw" />
                                                    </ExtraParams>
                                                </BeforeQuery>
                                            </DirectEvents>
                                        </ext:ComboBox>
                                    </Editor>
                                </ext:Column>
    I get the Message: TypeError: App.TreeGrid1.editingPlugin is undefined
    Is there a new synatx for data access?

    best regards
    I.
    Last edited by Daniil; Feb 05, 2015 at 10:37 AM. Reason: [CLOSED] [#680]
  2. #2
    Hi @IMehl,

    a) Please provide a full test case to reproduce the issue. You can provide a working v2 example and we could try to migrate it to v3.

    b) Please start a new forum thread. It is best to keep one issue per thread.
  3. #3

    Sample Version 2.5.3

    Hi Daniil,

    see the following sample.

    If you complie it with Ext.Net.dll Version 2.5.3 the left click executes the editor and the right click the contextmenu.
    if you compile the same with ext.net.dll 3.0.0 then the error above appears.

    for the second error i post a new thread.

    best regards
    I.

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>TreeGrid - Ext.NET Examples</title>
    
        <script runat="server">
        
            protected void OpenURL(object sender, DirectEventArgs e)
            {
                // Do something
            }
        
        
        </script>
    
        <link href="/resources/css/examples.css" rel="stylesheet" />
    
        <script>
            var formatHours = function (v) {
                if (v < 1) {
                    return Math.round(v * 60) + " mins";
                } else if (Math.floor(v) !== v) {
                    var min = v - Math.floor(v);
                    return Math.floor(v) + "h " + Math.round(min * 60) + "m";
                } else {
                    return v + " hour" + (v === 1 ? "" : "s");
                }
            };
    
            var handler = function (grid, rowIndex, colIndex, actionItem, event, record, row) {
                Ext.Msg.alert('Editing' + (record.get('done') ? ' completed task' : ''), record.get('task'));
            };
    
            var showContextMenu = function (view, cell, cellIndex, record, row, rowIndex, e) {
    
                var menu = App.CalcContextMenu;
                menu.Node_TASK = record.get("task");
    
                menu.showAt([e.getXY()[0], e.getXY()[1]]);
                e.stopEvent();
            }
    
            var beforeCellEditHandler = function (e) {
    
                if (e.column.dataIndex == "user") {
                    return true;
                }
                else {
                    return false;
                }
    
            }
    
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:Menu ID="CalcContextMenu" runat="server">
                <Items>
                    <ext:Label ID="Node_TASK" runat="server" Hidden="true" />
                    <ext:MenuSeparator Hidden="true" />
                    <ext:MenuItem runat="server" Text="Do Action" Icon="Accept">
                        <DirectEvents>
                            <Click OnEvent="OpenURL" />
                        </DirectEvents>
                    </ext:MenuItem>
                </Items>
            </ext:Menu>
    
            <ext:TreePanel
                runat="server"
                Title="Core Team Projects 2.5.3"
                Width="500"
                Height="300"
                Collapsible="true"
                UseArrows="true"
                RootVisible="false"
                MultiSelect="true"
                SingleExpand="true"
                FolderSort="true">
                <Store>
                    <ext:TreeStore runat="server" ID="Store1">
                        <Proxy>
                            <ext:PageProxy />
                        </Proxy>
                        <Model>
                            <ext:Model runat="server" IDProperty="_ID" Name="Model1" ClientIdProperty="_ID">
                                <Fields>
                                    <ext:ModelField Name="task" />
                                    <ext:ModelField Name="user" />
                                    <ext:ModelField Name="duration" />
                                    <ext:ModelField Name="done" Type="Boolean" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:TreeStore>
                </Store>
                <Plugins>
                    <ext:CellEditing runat="server" ClicksToEdit="1">
                        <Listeners>
                            <BeforeEdit Handler="return beforeCellEditHandler(e);"></BeforeEdit>
                        </Listeners>
                    </ext:CellEditing>
                </Plugins>
                <View>
                    <ext:TreeView runat="server" StripeRows="true" TrackOver="true">
                        <Listeners>
                            <CellContextMenu Fn="showContextMenu" StopEvent="true" PreventDefault="false" />
                        </Listeners>
                    </ext:TreeView>
                </View>
                <SelectionModel>
                    <ext:TreeSelectionModel runat="server" Mode="Single">
                    </ext:TreeSelectionModel>
                </SelectionModel>
                <ColumnModel>
                    <Columns>
                        <ext:TreeColumn
                            runat="server"
                            Text="Task"
                            Flex="2"
                            Sortable="true"
                            DataIndex="task" />
                        <ext:TemplateColumn
                            runat="server"
                            Text="Duration"
                            Flex="1"
                            Sortable="true"
                            DataIndex="duration"
                            Align="Center">
                            <Template runat="server">
                                <Html>
                                    {duration:this.formatHours}
                                </Html>
                                <Functions>
                                    <ext:JFunction Name="formatHours" Fn="formatHours" />
                                </Functions>
                            </Template>
                        </ext:TemplateColumn>
                        <ext:Column
                            runat="server"
                            Text="Assigned To"
                            Flex="1"
                            Sortable="true"
                            DataIndex="user">
                            <Editor>
                                <ext:TextField runat="server" ID="edtUser" />
                            </Editor>
                        </ext:Column>
                    </Columns>
    
                </ColumnModel>
    
                <Root>
                    <ext:Node Text="Tasks">
                        <Children>
                            <ext:Node Icon="Folder" Expanded="true">
                                <CustomAttributes>
                                    <ext:ConfigItem Name="task" Value="Project: Shopping" Mode="Value" />
                                    <ext:ConfigItem Name="duration" Value="13.25" />
                                    <ext:ConfigItem Name="user" Value="Clark Lewis" Mode="Value" />
                                </CustomAttributes>
                                <Children>
                                    <ext:Node Icon="Folder" Expanded="true">
                                        <CustomAttributes>
                                            <ext:ConfigItem Name="task" Value="Housewares" Mode="Value" />
                                            <ext:ConfigItem Name="duration" Value="1.25" />
                                            <ext:ConfigItem Name="user" Value="Clark Lewis" Mode="Value" />
                                        </CustomAttributes>
                                        <Children>
                                            <ext:Node Leaf="true">
                                                <CustomAttributes>
                                                    <ext:ConfigItem Name="task" Value="Kitchen supplies" Mode="Value" />
                                                    <ext:ConfigItem Name="duration" Value="0.25" />
                                                    <ext:ConfigItem Name="user" Value="Clark Lewis" Mode="Value" />
                                                </CustomAttributes>
                                            </ext:Node>
                                            <ext:Node Leaf="true">
                                                <CustomAttributes>
                                                    <ext:ConfigItem Name="task" Value="Groceries" Mode="Value" />
                                                    <ext:ConfigItem Name="duration" Value="0.4" />
                                                    <ext:ConfigItem Name="user" Value="Clark Lewis" Mode="Value" />
                                                    <ext:ConfigItem Name="done" Value="true" Mode="Raw" />
                                                </CustomAttributes>
                                            </ext:Node>
                                            <ext:Node Leaf="true">
                                                <CustomAttributes>
                                                    <ext:ConfigItem Name="task" Value="Cleaning supplies" Mode="Value" />
                                                    <ext:ConfigItem Name="duration" Value="0.4" />
                                                    <ext:ConfigItem Name="user" Value="Clark Lewis" Mode="Value" />
                                                </CustomAttributes>
                                            </ext:Node>
                                            <ext:Node Leaf="true">
                                                <CustomAttributes>
                                                    <ext:ConfigItem Name="task" Value="Office supplies" Mode="Value" />
                                                    <ext:ConfigItem Name="duration" Value="0.2" />
                                                    <ext:ConfigItem Name="user" Value="Clark Lewis" Mode="Value" />
                                                </CustomAttributes>
                                            </ext:Node>
                                        </Children>
                                    </ext:Node>
                                </Children>
                            </ext:Node>
                        </Children>
                    </ext:Node>
                </Root>
            </ext:TreePanel>
        </form>
    </body>
    </html>
  4. #4
    Thank you for the test case!

    Created an Issue:
    https://github.com/extnet/Ext.NET/issues/680

    Fixed in the revision #6314 (trunk). It goes to 3.1.0 beta.

    By the way, if you just started to migrate to 3.0 and didn't go too far, we would highly recommend you to use the latest Ext.NET sources from SVN trunk (upcoming 3.1). It fixed lots of issues discovered in 3.0.

Similar Threads

  1. [CLOSED] TreeGrid : get TreeGrid store data in JSON format
    By matrixwebtech in forum 2.x Legacy Premium Help
    Replies: 9
    Last Post: Jan 14, 2015, 1:28 PM
  2. Migration from ext 1.0 to 2.0
    By speedstepmem4 in forum 1.x Help
    Replies: 1
    Last Post: Jun 11, 2013, 9:14 AM
  3. [CLOSED] Migration from 1.5 to 2
    By IanPearce in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 29, 2012, 12:40 PM
  4. [1.0] Any thoughts on migration to asp.net 4.0?
    By michaeld in forum 1.x Help
    Replies: 1
    Last Post: Aug 19, 2010, 1:49 AM
  5. [CLOSED] TreeGrid: Header width when treegrid is flexible
    By wazige in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: May 06, 2010, 10:44 AM

Posting Permissions