Hi there,
I'm having an issue getting the grid with client detail template to work.
<
div
class
=
"row mt-3 mb-2"
>
<
div
class
=
"form-group col-md-12 "
>
@(Html.Kendo().Grid(Model)
.Name("ConditionAssessmentGrid")
.Columns(columns =>
{
columns.Bound(p => p.ConditionAssessmentYear);
columns.Bound(p => p.ConditionAssessmentId).Title("Actions").Width(100)
.ClientTemplate("<
div
class
=
'btn-group grid-commands'
role
=
'group'
>" +
"<
a
href
=
'/Sites/ConditionAssessment/ConditionAssessment/Summary/#=ConditionAssessmentId#'
class
=
'btn btn-primary btn-sm mr-2'
><
i
class
=
'fas fa-eye'
></
i
> View</
a
>");
})
.Sortable()
.ClientDetailTemplateId("conditionassessmentemplate")
.NoRecords(n => n.Template("<
span
class
=
'mt-3 mb-3 col-md-12 text-left'
>No data exists</
span
>"))
.Pageable(p => p.Enabled(false))
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
)
)
@Html.AntiForgeryToken()
<
script
id
=
"conditionassessmentemplate"
type
=
"text/kendo-tmpl"
>
@(Html.Kendo().Grid<
ProtectedSites.ViewModel.ConditionAssessment.ConditionAssessmentGridViewModel
>()
.Name("grid_#=ConditionAssessmentId#")
.Columns(columns =>
{
columns.Bound(p => p.FeatureInstance.FeatureName).Title("Feature");
columns.Bound(p => p.DateCreated).Title("Date created").Format("{0:dd/MM/yyyy}");
columns.Bound(p => p.CreatedUser).Title("Created by");
columns.Bound(p => p.LatestMonitoringDate).Format("{0:dd/MM/yyyy}").Title("Latest monitoring date");
columns.Bound(p => p.LatestMonitoringLevelOneResult).Title("Condition assessment 1");
columns.Bound(p => p.LatestMonitoringLevelTwoResult).Title("Condition assessment 2");
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(5)
.Read(read => read.Action("GetFeatureInstances", "ConditionAssessment", new { siteid = ViewContext.RouteData.Values["SiteId"], conditionAssessmentId = "#=ConditionAssessmentId#" }))
)
.Pageable()
.Sortable()
.ToClientTemplate()
)
</
script
>
</
div
>
</
div
>
My Parent grid model and child grid model both have a property named ConditionAssessmentId. However, when expanding the detail template, the read action always fails with the following error:
Uncaught ReferenceError: conditionassessmentid is not defined
at Object.eval [as tmpl0] (eval at compile (kendo.all.js:234), <
anonymous
>:3:1645)
at Object.eval (eval at compile (kendo.all.js:234), <
anonymous
>:3:185)
at proxy (jquery.js:10771)
at init._toggleDetails (kendo.all.js:69238)
at HTMLAnchorElement.<
anonymous
> (kendo.all.js:69226)
at HTMLTableElement.dispatch (jquery.js:5429)
at HTMLTableElement.elemData.handle (jquery.js:5233)
I do note that it does correctly resolve the same binding expression in the Name property of the child grid, just not for the Read event.
Am I doing something obvious wrong here? I've referred to your DetailTemplate example and can't see anything I am doing differently.
Thanks,
Paul