PDA

View Full Version : [CLOSED] Tree panel node icon change



alscg
Jan 07, 2014, 5:52 AM
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 7449for output and highlighted icons to be removed(hide).

Thanks

Daniil
Jan 07, 2014, 12:34 PM
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")