Hi,
How to expand the detail template automatically when ClientRowTemplate is used? Here is the code I have. Not sure what is missing.
@(Html.Kendo().Grid<
Models.ResViewModel
>()
.Name("grid")
.HtmlAttributes(new { style = "height:550px; width:100%;" })
.ClientRowTemplate(
"<
tr
data-uid
=
'#: uid #'
class
=
'k-master-row'
role
=
'row'
><
td
class
=
'k-hierarchy-cell'
aria-expanded
=
'true'
><
a
class
=
'k-icon k-i-collapse'
href
=
'\\#'
aria-label
=
'Collapse'
tabindex
=
'-1'
></
a
></
td
>" +
"<
td
>" +
"<
div
><
span
><
b
>Name :</
b
></
span
> #: FullName# </
div
>" +
"<
div
>Contact Info/Comments : #: Comments# </
div
>" +
"<
div
>State : #: State# </
div
>" +
"<
div
>SRID : #: SRID# </
div
>" +
"</
td
>" +
"</
tr
>"
)
.ClientDetailTemplateId("questionTemplate")
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(1)
.Model(model => model.Id(p => p.SID))
.Read(read => read.Action("GetResponses", "SUser"))
)
.Events(events => events.DataBound("dataBound"))
.Scrollable()
.Pageable(pageable => pageable
.Refresh(false)
.ButtonCount(5))
)
<
script
id
=
"questionTemplate"
type
=
"text/kendo-tmpl"
>
@(Html.Kendo().Grid<
Models.SQViewModel
>()
.Name("grid_#=State#")
.Columns(columns =>
{
columns.Bound(o => o.SortOrder);
columns.Bound(o => o.QuestionText);
})
.Pageable()
// .AutoBind(true)
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(5)
.Read(read => read.Action("DetailTemplate_HierarchyBinding_Questions", "SUser", new { surveyID = "#=SID#" }))
)
.Events(events => events.DataBound("dataBound"))
.ToClientTemplate()
)
</
script
>
<
script
>
function dataBound() {
this.expandRow(this.tbody.find("tr.k-master-row").first());
this.expandRow(this.tbody.find("tr.k-detail-row").first());
}
</
script
>