[CLOSED] JavaScript error - RowExpander and component TreeGrid

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] JavaScript error - RowExpander and component TreeGrid

    Hello!

    I have
    GridPanel -> Grouping + RowExpand( Load component - partition view(TreeGrid))

    If I change mouse cursor position in treeGrid JavaScript throws an error
    (Uncaught TypeError: Cannot read property 'isCollapsedPlaceholder' of null)

    It is necessary to fix it

    Index.cshtml
    @
    @using Ext.Net.MVC
    @using Icon = Ext.Net.Icon
    @using Region = Ext.Net.Region
    
    @model ICollection<StageItemModel>
    
    @{
        ViewBag.Title = "";
        Layout = "~/Views/Shared/_BaseLayout.cshtml";
        var X = Html.X();
    }
    
    @section bodySection
    {
        @(X.Viewport()
              .MinWidth(1245)
              .MinHeight(600)
              .Layout(LayoutType.Border)
              .AutoScroll(true)
              .Items(
                  X.GridPanel()
                      .ID("gpnlCalPlan")
                      .Title("CalPlan")
                      .Region(Region.Center)
                      .Flex(1)
                      .Frame(true)
                      .Store(
                          X.StoreForModel()
                              .Proxy(X.AjaxProxy()
                                  .Url(Url.Action("LoadCalendarPlan"))
                                  .Reader(X.JsonReader().RootProperty("data"))
                                  .ActionMethods(methods => methods.Read = HttpMethod.POST)
                              )
                              .GroupField("CalendarPlanName")
                      )
    
    
                      .ColumnModel(
                          X.Column().DataIndex(Model, m => m.CalendarPlanName).Text("CalPlan").Hidden(true),
                          X.Column().DataIndex(Model, m => m.Name).Text("Stage Name").MinWidth(150).Flex(1),
                          X.DateColumn().DataIndex(Model, m => m.DateTo).Text("Date To").MinWidth(150)
                      )
                      .Plugins(Html.X().RowExpander()
                          .Loader(Html.X().ComponentLoader()
                              .Url(Url.Action("GetGrid"))
                              .Mode(LoadMode.Component)
                              .LoadMask(mask => mask.ShowMask = true)
                          ).ExpandOnEnter(true)
                          .ExpandOnDblClick(true)
                          .SingleExpand(true)
                      )
                      .View(
                          Html.X().GridView()
                      )
                      .Features(
                          Html.X().Grouping()
                              .ID("grCalendarPlan")
                              .GroupHeaderTplString("{columnName}: {name}")
                              .StartCollapsed(false)
                      )
              ))
    }
    Model
     public class StageItemModel
        {
            public string Name { get; set; }
            public string CalendarPlanName { get; set; }
            public DateTime DateTo { get; set; }
        }
    Methods in controller
     public ActionResult Index()
            {
                return View();
            }
    
    
    
            public ActionResult LoadCalendarPlan()
            {
                var ListStage = new List<StageItemModel>
                {
                    new StageItemModel()
                    {
                        CalendarPlanName = "CalPlan 1",
                        Name = "Stage 1",
                        DateTo = DateTime.Now.AddDays(5)
                    },
                    new StageItemModel()
                    {
                        CalendarPlanName = "CalPlan 1",
                        Name = "Stage 2",
                        DateTo = DateTime.Now.AddDays(10)
                    },
                    new StageItemModel()
                    {
                        CalendarPlanName = "CalPlan 1",
                        Name = "Stage 3",
                        DateTo = DateTime.Now.AddDays(15)
                    },
                    new StageItemModel()
                    {
                        CalendarPlanName = "CalPlan 2",
                        Name = "Stage 4",
                        DateTo = DateTime.Now.AddDays(5)
                    },
                    new StageItemModel()
                    {
                        CalendarPlanName = "CalPlan 2",
                        Name = "Stage 5",
                        DateTo = DateTime.Now.AddDays(10)
                    },
                    new StageItemModel()
                    {
                        CalendarPlanName = "CalPlan 2",
                        Name = "Stage 6",
                        DateTo = DateTime.Now.AddDays(15)
                    }
                };
    
                return this.Store(ListStage);
            }
    
    
            public ActionResult GetGrid(StoreRequestParameters parameters)
            {
                var root = new Node
                {
                    Text = "root"
                };
                root.CustomAttributes.Add(new ConfigItem
                {
                    Name = "Comment",
                    Value = "Comment root"
    
                });
    
                var child1 = new Node
                {
                    Text = "child1"
                };
                child1.CustomAttributes.Add(new ConfigItem
                {
                    Name = "Comment",
                    Value = "Comment 1"
    
                });
    
                var child2 = new Node
                {
                    Text = "child2"
                };
                child2.CustomAttributes.Add(new ConfigItem
                {
                    Name = "Comment",
                    Value = "Comment 2"
    
                });
    
                root.Children.Add(child1);
                root.Children.Add(child2);
    
                return this.ComponentConfig("InnerGrid", root);
                //return this.ComponentConfig("InnerGrid", ExtNetModel.GetAllExtModels());
    
            }
    InnerGrid.cshtml
    @model Node
    
        @{
            var X = Html.X();
        }
    
        @(
    
                 X.TreePanel()
                      .ID("tpnlDetail")
                      .Region(Region.Center)
                      .RootVisible(true)
                      .AutoScroll(true)
                      .Width(600)
                      .Height(300)
                      .ColumnModel(
                          X.TreeColumn().Width(150)
                              .DataIndex("text"),
    
    
                          X.Column().Width(150)
                              .DataIndex("Comment")
    
                      )
                      .AutoLoad(false)
                      .Root(Model)
    
        )
    Last edited by fabricio.murta; May 24, 2016 at 7:47 PM.
  2. #2
    Hello @SuperBolt!

    Your example is looking good! I could run it here. Well, the problem is just that the example you provided is not triggering any error when I hover the mouse over the inner grids' tree column items. I tried also clicking, expanding, switching between different rowExpander (outer grid) entries, but couldn't trigger any errors. Are you using a particular Ext.NET version not 3.3 or not the SVN latest release?
    Fabrício Murta
    Developer & Support Expert
  3. #3
    I have last version 3.x in Nuget manager - Ext.Net mvc 3.3

    packages.config
      <package id="Ext.NET.MVC5" version="3.3.0" targetFramework="net452" />
      <package id="Ext.NET.Utilities" version="2.5.0" targetFramework="net452" />
      <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net452" />
      <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net452" />
      <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net452" />
      <package id="Microsoft.Owin" version="3.0.1" targetFramework="net452" />
      <package id="Microsoft.Owin.Host.HttpListener" version="3.0.1" targetFramework="net452" />
      <package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net452" />
      <package id="Microsoft.Owin.Hosting" version="3.0.1" targetFramework="net452" />
      <package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net452" />
      <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
      <package id="Newtonsoft.Json" version="8.0.1" targetFramework="net452" />
      <package id="Owin" version="1.0" targetFramework="net452" />
      <package id="Transformer.NET" version="2.1.1" targetFramework="net452" />
      <package id="WebActivatorEx" version="2.0.6" targetFramework="net452" />
    Error:

    Click image for larger version. 

Name:	Error.jpg 
Views:	110 
Size:	80.5 KB 
ID:	24586

    Error is reproduced in Chrome, Opera, Firefox, IE9. Edge exclusion
    Chrome v49.0.2623.112 m
  4. #4
    Upd:
    Chrome console
    Uncaught TypeError: Cannot read property 'down' of null
    Uncaught TypeError: Cannot read property 'parentNode' of null
    Uncaught TypeError: Cannot read property 'visibilityMode' of undefined
    if Expand all levels in the first tree, then collapse top level in in the second tree

    + At different iterating Collapse\Expand
  5. #5
    Hello SuperBolt!

    That's interesting, I'm using NuGet version also. 3.3.0 currently.

    And alright, I got a problem here, it is in much smaller scale than yours and I can only trigger it in this situation:
    - browser: IE11
    - developer tools (F12) open
    - move the mouse from the panel (page body) out to the developer tools window

    And a mouseOut event is triggered on some weird way that triggers a single JavaScript bug.

    Now if I switch to Chrome 49, I can open developer tools, move mouse around, expand, collapse and click. Nothing, not a single console hitch.

    As for the problem I could reproduce on IE11, switching the viewport's laytou to LayoutType.Fit allowed me to no longer have the problem triggering. This may require a little more investigation, but I am afraid this is not really what you got there. Can you try changing your view's line 19 to use Fit instead of Border just to see whether the errors stop for you too?

    And I have another idea that could help guarantee we are trying in the exact same environment.

    What if you created a new blank project+solution, installed Ext.NET packages, and run the example on it? If you can reproduce the issue on that clean project, then you can pack and let us download and run it locally to try and reproduce it!

    If you agree that it would be a good idea, please also consider this while packing your sample project:
    - do not let any Ext.NET keys in it! You don't need Ext.NET keys to run projects locally, so dont even bother adding the key once you install the NuGet package!
    - DLLs from NuGet packages will just clobber the zipped file. Before zipping, clean the solution (or just remove the bin/ and obj/ folders that are created onto your project folder) and also delete directories inside packages/ -- retain the packages.config file that is on packages/ folder!.
    - it would be easier to have NuGet packages you use in sync if you created a new solution with that single project and zipped the whole (cleaned) solution directory!
  6. #6
    Hello, fabricio.murta!

    I Create Empty project - Reproduced error

    Click image for larger version. 

Name:	listError.jpg 
Views:	76 
Size:	89.5 KB 
ID:	24589

    Dropbox. Source code


    Ext.define('Ext.net.RowExpander', {
        extend: 'Ext.plugin.Abstract',
        lockableScope: 'normal',
        requires: ['Ext.grid.feature.RowBody'],
        alias: 'plugin.netrowexpander',
        columnWidth: 24,
        mixins: {
            observable: 'Ext.util.Observable'
        },
    	.....
    	
    	 toggleRow: function(rowIdx, record, state) {
    
          ...
            if (me.expanderColumn) {
                expanderCell = Ext.fly(view.getRow(rowIdx)).down(me.expanderColumn.getCellSelector(), true);   //!!!!!!!!!!!!!!!!!!!!ERROR 
                if (expanderCell) {
                    expanderCell.rowSpan = rowSpan;
                }
            }
            ...
        },
    	...
    	(Ext.cmd.derive("Ext.grid.feature.GroupStore", Ext.util.Observable, {
        isStore: true,
        defaultViewSize: 100,
        isFeatureStore: true,
        badGrouperKey: "[object Object]",
        constructor: function(c, a) {
            var b = this;
            Ext.util.Observable.prototype.constructor.call(this);
            b.groupingFeature = c;
            b.bindStore(a);
            if (!c.grid.isLocked) {
                b.bindViewStoreListeners()
            }
        },
         ...........
        indexOf: function(a) {
            var b = -1;
            if (!a.isCollapsedPlaceholder) {   //!!!!!!!!!!!!!!!!!!!!!ERROR   a is undefind
                b = this.data.indexOf(a)  
            }
            return b
        },
  7. #7
    Hello! Your project didn't work here at all. I noticed there were missing essential Ext.NET files which only were installed after I manually uninstalled and re-installed the NuGet package (yes, I did restore the packages before).

    And no, the missing files weren't files in the packages directories, but files that get set up by Ext.NET during the package installation, they should be in the project folders. Notably, the route config file under App_Start.

    The files in the project you provided suggests you are using VS2013, what I am also using here to test your project, so then it shouldn't be the Visual Studio version acting differently, but there's something strange, because your project shouldn't even work with those essential Ext.NET files. Maybe you zipped the wrong project by any chance?

    I can't really believe it, but who knows -- do your project run fine without the App_Start/ExtNetConfig.cs? The one you share does not have this file, among other files that are installed with Ext.NET from NuGet (package Ext.NET.MVC5, version 3.3.0).

    EDIT: oh, and yes, when I make the project work, I still can't reproduce the errors that are happening to you! Strange that you get down to JavaScript, but it could very well be a mismatching/old DLL getting in the way somehow!
  8. #8
    Hello!

    I Have VS 2015 and IIS 10(I think it is not important)
    + reproduced Ext.net mvc 4.0

    Check out the new link. I configure the project to another
    New project

    I checked on another machine - it project works

    ps I found another bag
    if I use Proxy(X.AjaxProxy() .... and .PageSize(50) and .Grouping().StartCollapsed(true)
    Then going to another page - StartCollapsed value is set false(reproduced ext.net mvc 3.3 and 4.0)

    Create a new topic?
  9. #9
    I checked on another machine - it project works
    What you actually mean with what you said above? You cannot also reproduce the issue when you run the project you provided on another computer?

    Well, anyways, I could finally reproduce the issue on chrome with your project! I'll be giving it a good look and try to determine the roots of the problem.

    Just as a reminder, have you seen this example and the limitations it points at using nested grids in RowExpander?
    Grid Panel - Row Expander - Multi level grid panels.

    There's a good chance I'm going to stumble on one of the limitations mentioned there.
    Fabrício Murta
    Developer & Support Expert
  10. #10
    What you actually mean with what you said above? You cannot also reproduce the issue when you run the project you provided on another computer?
    Sorry! Problem reproduce.

    Repeat. This problem is reproduce in ext.net mvc 3.3 and 4.0 (Just in case).

    Grid Panel - Row Expander - Multi level grid panels.
    Maybe you're right, but I cannot be compared with any of the items. Maybe the default value is a prohibited value. Or because of the layout
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 7
    Last Post: Jul 08, 2015, 1:25 AM
  2. [CLOSED] An javascript error in component column
    By capbarbell in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Jan 04, 2014, 6:11 AM
  3. Replies: 2
    Last Post: Jun 27, 2013, 10:18 PM
  4. Replies: 5
    Last Post: May 17, 2013, 4:54 PM
  5. Replies: 8
    Last Post: Feb 06, 2013, 6:27 PM

Tags for this Thread

Posting Permissions