[CLOSED] Tree panel node icon change

  1. #1

    [CLOSED] Tree panel node icon change

    Hi,

    I am using Tree panel with 'AttributesObject'. And set property value of tree panel to 'Icon(Icon.None)' to hide default icon(Folder) displayed for each node.

    But it is not working for me, could you please suggest what needs to be added to hide default icons for each node of Tree panel.

    Here is my code looks like -
    View
    @model NodeCollection
    
    @(Html.X().ResourceManager())
    
    @(Html.X().Container().ID("EntityDisplayTree").Items(
            Html.X().TreePanel().ID("EntityDisplayTreeNotes").Header(false)
            .RootVisible(false)
            .Icon(Icon.None)
            .UseArrows(true)
            .Fields(
                    Html.X().ModelField().Name("entityText"),
                    Html.X().ModelField().Name("iconHtml").Type(ModelFieldType.String)
            )
            .ColumnModel(
                    Html.X().Column().Align(Alignment.Right).DataIndex("iconHtml").Renderer("displayIcons").Width(75),
                    Html.X().TreeColumn().DataIndex("entityText").Width(280)
            )
            .Root(Html.X().Node().NodeID("0").Text("All Notes").Children(Model))
        )
    )
    <script type="text/javascript">
    
        var displayIcons = function (value, meta, record, index) {
            return Ext.String.format(record.data.iconHtml);
        };
    
    </script>
    Controller code
    public ActionResult TreeProblem()
            {
                var nodeCollection = new NodeCollection();
    
                Node rootStartNode = new Node();
                rootStartNode.AttributesObject = new
                {
                    entityText = "RootStartNode",
                    iconHtml = "icon",
                };
    
                rootStartNode.Expanded = true;
                nodeCollection.Add(rootStartNode);
    
    
                var node1 = new Node();
                node1.AttributesObject = new
                {
                    entityText = "Node1",
                    iconHtml = "icon1",
                };
    
                var node1Child = new Node();
                node1Child.Leaf = true;
                node1Child.AttributesObject = new
                {
                    entityText = "Node1Child",
                    iconHtml = "icon1Child",
                };
                node1.Children.Add(node1Child);
    
                rootStartNode.Children.Add(node1);
    
    
                return View(nodeCollection);
            }
    Also please see the image Click image for larger version. 

Name:	FolderIcon.png 
Views:	15 
Size:	6.1 KB 
ID:	7449for output and highlighted icons to be removed(hide).

    Thanks
    Last edited by Daniil; Jan 14, 2014 at 7:38 AM. Reason: [CLOSED]
  2. #2
    Hi @alscg,

    Yes, Icon.None doesn't do anything. We have a ticket for that.
    https://github.com/extnet/Ext.NET/issues/167

    To hide all the icons you can set up this for a TreePanel.
    <style>
        .no-node-icon img.x-tree-icon {
            display: none;
        }
    </style>
    Html.X().TreePanel().Cls("no-node-icon")

Similar Threads

  1. Replies: 3
    Last Post: Jun 27, 2014, 11:38 AM
  2. [CLOSED] Change tree node font size
    By gs_user in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 13, 2013, 9:35 AM
  3. Change Node Icon
    By 4L4Y in forum 2.x Help
    Replies: 1
    Last Post: Jun 10, 2013, 4:31 AM
  4. [CLOSED] Change Node Name dynamically in tree panel
    By Etisbew in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jun 29, 2009, 10:49 AM
  5. Replies: 2
    Last Post: Apr 02, 2009, 8:13 AM

Posting Permissions