3 Answers, 1 is accepted
0
Hello Mark,
Did you try to set the .DataSpriteCssClassField option for the TreeView to be the same as the property name that holds the css class, that you mentioned you want to return from the controller.
e.g.
Kind Regards,
Petur Subev
Telerik
Did you try to set the .DataSpriteCssClassField option for the TreeView to be the same as the property name that holds the css class, that you mentioned you want to return from the controller.
e.g.
@(Html.Kendo().TreeView()
.Name("treeview")
.HtmlAttributes(new {@class="demo-section" })
.DataTextField("Name")
.DataSpriteCssClassField("SpriteCssClasses")
.DataSource(dataSource => dataSource
.Read(read => read
.Action("Employees", "TreeView")
)
)
)
Kind Regards,
Petur Subev
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Mark
Top achievements
Rank 1
answered on 09 May 2014, 08:29 AM
Hi Petur
I'm not sure I quite understand. The TreeViewItemModel does not have a SpriteCssClasses.
The values from the controller are of the form:
And the html is:
Thanks for your help.
Mark
I'm not sure I quite understand. The TreeViewItemModel does not have a SpriteCssClasses.
The values from the controller are of the form:
lastItem.Items.Add(
new
TreeViewItemModel { Id = svnUrl + aggregateSubPath, Text = subPath });
@(
Html.Kendo()
.TreeView()
.Name(
"treeview"
)
.BindTo((IEnumerable<TreeViewItemModel>)ViewBag.treeView)
.DataSpriteCssClassField(
"SpriteCssClasses"
)
.Checkboxes(checkboxes => checkboxes
.Name(
"checkedFiles"
)
.CheckChildren(
true
))
)
<style scoped>
#treeview .k-sprite {
background-image: url(
"@Url.Content("
../../styles/Default/sprite.png
")"
);
}
.rootfolder { background-position: 0 0; }
.folder { background-position: 0 -16px; }
.pdf { background-position: 0 -32px; }
.html { background-position: 0 -48px; }
.image { background-position: 0 -64px; }
</style>
Thanks for your help.
Mark
0
Hello Mark,
Thank you for bringing this issue to our attention. Indeed the SpriteCssClass is missing from the TreeViewItemModel class. We fixed this internally and it will become available within the next internal build.
As a small sign of our gratitude I updated your telerik points.
Regards,
Petur Subev
Telerik
Thank you for bringing this issue to our attention. Indeed the SpriteCssClass is missing from the TreeViewItemModel class. We fixed this internally and it will become available within the next internal build.
As a small sign of our gratitude I updated your telerik points.
Regards,
Petur Subev
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.