Error: can't expand a TreePanel with two levels nodes

  1. #1

    Error: can't expand a TreePanel with two levels nodes

    I have two problems with a tree node.I used a tree panel to display a 2-level tree of privileges with check boxes at the leaf nodes .
    the first problem: when I expanded the first node it is expanded fine but when i expanded the second node it wasn't. without any javascript error
    the second problem: when I expand the first node and click on check box of leaf node it didn't checked but the following checkbox is checked.


    after more clicks on check boxes, javascript error raised
    Unhandled exception at line 1476, column 46 in http://XXX/extnet/extnet-all-js/ext.axd?v=31282
    JavaScript runtime error: Unable to get property 'get' of undefined or null reference
    with debuging i found record is null in this method
    onCheckChange: function(record) {
    var checked = record.get('checked');
    if (Ext.isBoolean(checked)) {
    checked = !checked;
    record.set('checked', checked);
    this.fireEvent('checkchange', record, checked);
    }
    }


    I used the ext.net v2.5.1 downloaded from ext,net site because I faced [property 'isCollapsedPlaceholder' of undefined or null reference] proplem that solved in this thread http://forums.ext.net/showthread.php...null-reference


    View Page:
    @model Ext.Net.Node
    @{
        ViewBag.Title = "Group privileges";
    }
    @(Html.X().ResourceManager().ScriptMode(Ext.Net.ScriptMode.Development))
    
    @using (Html.BeginForm())
    {
        @Html.AntiForgeryToken()
        <div class="form-horizontal">     
            <div class="back-link">
                @Html.ActionLink("Back to List", "Index", null, new { @class = "pull-right" })
            </div>      
        </div>    
    <div style="padding-top: 30px;">
    
            @( Html.X().TreePanel().ID("TreePanel").Border(false)
                    .DisplayField("text") //Kp_Naziv
                    .Height(400).Width(500).UseArrows(false).Border(false).AutoScroll(true).Animate(true).RootVisible(false)
                    .Root(Model)
            )
    </div>
        
     <div class="form-horizontal">   
        <div class="form-group">
            <div class="col-md-offset-2 col-md-10">
                @Html.ActionLink("Back to Groups", "Index", null, new { @class = "btn btn-default" })
                <input type="submit" value="Save" class="btn btn-default" onclick="return Save()" />
            </div>
        </div>
    </div>
    }
    CS code: Action
     public ActionResult Privileges(int id)
            {
                ViewBag.GroupID = id;
                Ext.Net.Node rootNode = new Node { NodeID = "0", Text = "Root", Checked = false, Icon = Icon.Folder, Leaf = false,Expanded=true}; 
                var lists = db.Lists.ToList();
                var groupColumn = db.GroupListItems.Where(o => o.GroupID == id);
                foreach (var list in lists)
                {
                    Ext.Net.Node node = new Node { NodeID = list.ListID.ToString(), Text = list.ListName, Icon = Icon.Table, Leaf = false,Expanded=false };
                    var columns = list.ListItems;
                    foreach (var column in columns)
                    {
                        node.Children.Add(new Node { NodeID = column.ListItemID.ToString(), Text = column.ItemID, Icon = Icon.TableColumn, Leaf = true, Checked = groupColumn.Any(o => o.ListItemID == column.ListItemID) });
                    }
    
                    rootNode.Children.Add(node);
                }          
                return View("Privileges", rootNode);
            }
    Attached Thumbnails Click image for larger version. 

Name:	2.PNG 
Views:	87 
Size:	14.3 KB 
ID:	10571  
    Last edited by Daniil; May 09, 2014 at 1:59 PM. Reason: cann't => can't
  2. #2

    I get the error

    thank you, I reached to the error. there are more nodes have the same id number.

Similar Threads

  1. [CLOSED] pre-loading a TreePanel BUT only for 1 or 2 levels?
    By adrianot in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 07, 2014, 2:54 PM
  2. [CLOSED] Error when expand treepanel Node
    By AdminAISN in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 17, 2013, 7:13 PM
  3. [CLOSED] Treepanel problem nodes expand
    By JCarlosF in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Mar 06, 2013, 2:36 PM
  4. Replies: 18
    Last Post: Jan 23, 2013, 3:20 PM
  5. Treepanel: expand ~1500 nodes gives error
    By RobOtter in forum 1.x Help
    Replies: 3
    Last Post: Jul 14, 2011, 12:33 PM

Tags for this Thread

Posting Permissions