Here is my grid setup:
@(Html.Kendo().Grid<AssetViewModel>()
.Name("assetGrid")
.Columns(columns =>
{
columns.Bound(p => p.AssetId).Visible(false);
columns.Bound(p => p.AssetName).Title("Name").Filterable(false).Sortable(false)
.HtmlAttributes(new { style = "k-text-center !k-justify-content-center" }).HeaderHtmlAttributes(new { style = "k-text-center !k-justify-content-center" })
.ClientTemplate("<div class='identifier-container'><a href='" + Url.Action("ViewAsset", "Revenue", new { assetId = "#=AssetId#" }) + "'>#=AssetName#</a></div>");
columns.Bound(p => p.CategoryName).Title("Category").Width(130)
.HtmlAttributes(new { style = "text-align:center" }).HeaderHtmlAttributes(new { style = "text-align: center; justify-content: center" })
.ClientTemplate("<span class='#=CategoryCss#' title='#=CategoryName#'>#=CategoryName#</span>");
columns.Bound(p => p.ContactName)
.ClientTemplate("<span title='#+ContactName#'>#=ContactName#</span>");
columns.Bound(p => p.Age).Title("Age").Width(70)
.HtmlAttributes(new { style = "text-align:center" }).HeaderHtmlAttributes(new { style = "text-align: center; justify-content: center" });
columns.Bound(p => p.Cost).Title("Cost").Width(100)
.HtmlAttributes(new { style = "text-align:center" }).HeaderHtmlAttributes(new { style = "text-align: center; justify-content: center" });
columns.Bound(p => p.Investors).Title("Shares").Width(75)
.HtmlAttributes(new { style = "text-align:center" }).HeaderHtmlAttributes(new { style = "text-align: center; justify-content: center" });
columns.Bound(p => p.AssetId).Title("Act").Width(50).Filterable(false)
.HtmlAttributes(new { style = "text-align:center" }).HeaderHtmlAttributes(new { style = "text-align: center; justify-content: center" })
.ClientTemplate("<a href='" + Url.Action("EditAsset", "Revenue", new { assetId = "#=AssetId#" }) + " ' title='Edit the Asset'><i class='fa-duotone fa-pen-to-square fa-fw fa-lg theme-elevate-fa'></i></a>");
})
.ClientDetailTemplate(Html.Kendo().Template()
.AddComponent(detailStrip => detailStrip
TabStrip().Name("tabStrip_${data.AssetId}")
.SelectedIndex(0)
.Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
.Items(tabs =>
{
tabs.Add().SpriteCssClasses("fa-duotone theme-elevate-fa fa-magnifying-glass ").Text("Details").LoadContentFrom("GetAssetDetails", "Revenue", new { masterGridId = "${data.AssetId}" });
tabs.Add().SpriteCssClasses("fa-duotone theme-elevate-fa fa-chart-mixed ").Text("Charts ").LoadContentFrom("GetLetterApprovers", "Revenue", new { masterGridId = "${data.AssetId}" });
tabs.Add().SpriteCssClasses("fa-duotone theme-elevate-fa fa-clock-rotate-left").Text("History").LoadContentFrom("GetLetterDetails", "Revenue", new { masterGridId = "${data.AssetId}" });
})
)
)
.Size(ComponentSize.Small)
.ToolBar(toolbar => { toolbar.Search(); })
.Search(s =>
{
s.Field(o => o.AssetName, "contains");
s.Field(o => o.CategoryName, "contains");
s.Field(o => o.ContactName, "contains");
})
.Scrollable(s => s.Height("auto"))
.Reorderable(r => r.Columns(false))
.Resizable(r => r.Columns(true))
.Pageable(p =>
{
p.Refresh(false);
p.PageSizes(new[] { 5, 10, 20, 25, 50, 75, 100, 125, 150, 175, 200 });
p.ButtonCount(10);
p.Info(true);
})
//.Filterable()
.Sortable()
//.ColumnMenu(col => col.Filterable(false).Enabled(false))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("AssetListData", "Revenue"))
.Sort(sort => sort.Add(nameof(AssetViewModel.AssetName)).Ascending())
.PageSize(20)
))
I'm having a few issues:
- Tab FontAwesome icons are not showing*
- the `masterGridId = "${data.AssetId}"` is not translating properly, and the actual parameter value sent back to action is a string: "${data.AssetId}"*
- At a given time, only one row must be expanded as the application is going to be used on a mobile screen
- Lastly, is there any chance of converting this into TagHelper format?
The '*' questions are most important.