PDA

View Full Version : [CLOSED] [#1372] [4.1.0] NestedList - Icons



sveins12
Aug 14, 2016, 1:33 PM
Is it possible to show the icons in the NestedList, eventually by defining a template for the nodes?


@{
var x = Html.X();
}
@(
x.NestedList()
.Store(c=> c.Add(x.TreeStore()
.Root(x.Node()
.Children(
x.Node()
.Text("Node0")
.Icon(Icon.Brick)
)
)
))
)

fabricio.murta
Aug 16, 2016, 1:04 AM
Hello @sveins12!

Use you .Icon(<icon_here>) approach and add this to the NestedList definition:



.CustomConfig(c => c.Add(
new ConfigItem()
{
Name = "ListConfig",
Value = "{ itemTpl: '<span class=\"{iconCls}\" style=\"float:left; width:20px; height:20px\"></span>{text}' }",
Mode = ParameterMode.Raw
}
))


Unfortunately I couldn't write the same using a better approach (aka .ListConfig()) but I'll give it a better look and create an issue if I am really unable to define the item template thru ListConfig directly.

fabricio.murta
Aug 22, 2016, 1:59 AM
Hello! Sorry for the late feedback. We actually investigated the issue and fixed it, allowing you to properly define the template to display the list item with an icon.

Issue was #1372 (https://github.com/extnet/Ext.NET/issues/1372), addresses the problem with customizing the list items, and you can use it now instead of the workaround provided.