Hello,
I've got a grid with a client template set but everytime I click to expand the details row, the details collapse immediately. I don't know what is causing it. Here's my grid implemention.
@(Html.Kendo().Grid<AWP.UI.ViewModel.UIdto.Manufacturer>()
.Name("Manufacturers")
.Columns(columns =>
{
columns.Command(command =>
{
command.Edit();
});
columns.Bound(c => c.RecordState).Title("Active").ClientTemplate("<input type='checkbox' #= RecordState ? checked='checked' :'' # disabled />");
columns.Bound(c => c.DisplayValue).Title("Display Value");
columns.Bound(c => c.DisplayCode).Title("Display Code");
columns.Bound(c => c.DisplayOrder).Title("Display Order");
columns.Bound(c => c.InterfaceCode).Title("Interface Code");
columns.Template(c => null).ClientTemplate("#if(RecordState==0){#<button class='k-button k-button-icontext' onClick='Activate(\"#=ManufacturerId#\")'>Activate</button>#}else{#<button class='k-button k-button-icontext' onClick='Deactivate(\"#=ManufacturerId#\")'>Deactivate</button>#}#");
})
.ToolBar(toolbar =>
{
toolbar.Template(@<text>
<div class="toolbar">
<div class="row">
<div class="col-md-4">
<div class="input-group">
<input type="text" class="form-control k-textbox" id='FieldFilter' placeholder="Search for...">
</div>
</div>
</div>
</div>
</text>);
})
.ClientDetailTemplateId("mytemplate")
.AutoBind(true)
.Scrollable()
.Resizable(resizing => resizing.Columns(true))
.Sortable(sorting => sorting.Enabled(true))
.Reorderable(reorder => reorder.Columns(true))
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Pageable(pageable => pageable
.Input(true)
.Numeric(false)
)
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(p => p.ManufacturerId);
model.Field(p => p.ManufacturerId).Editable(false);
model.Field(p => p.RecordState).Editable(false);
})
.PageSize(20)
.Read("Read", "Manufacturer")
.Update("Update", "Manufacturer")
)
.Events(events => events
.DetailInit("detailExpand")
)
)
My template is simple:
<script id="mytemplate" type="text/x-kendo-template">
<div>
This is my details view #: DisplayValue #
</div>
</script>
My detailExpand method only contains a debugger. I can catch the expansion only when debugging. Without debugging, the expansion is invisible. I've tried programmatically expanding the row but the row always collapses after i call expandRow().
var grid = $("#Manufacturers").data("kendoGrid");
expandedRowUid = e.masterRow.data('uid');
grid.expandRow($('tr[data-uid=' + expandedRowUid + ']'));
Why is this happening?