This is a migrated thread and some comments may be shown as answers.

Details Row immediately collapses after expand

3 Answers 343 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Coy
Top achievements
Rank 1
Coy asked on 03 May 2018, 03:28 PM

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?

3 Answers, 1 is accepted

Sort by
0
Coy
Top achievements
Rank 1
answered on 03 May 2018, 03:30 PM

By the way, it doesn't appear that grid data binding is the culprit because even with a dataBound handler method, it doesn't call dataBound after I try to programmatically expand the row.

 

I'm using kendo version kendo/2017.3.913

0
Coy
Top achievements
Rank 1
answered on 03 May 2018, 08:21 PM

Woops, just realized I posted an MVC implementation in the jquery forum.

 

Can this be moved?

0
Coy
Top achievements
Rank 1
answered on 04 May 2018, 01:05 AM

Well, I managed to find the issue by stripping down my page.  Seems like a bug maybe.

I was setting the height of the grid on document.ready() like this:

$('#Manufacturers').kendoGrid({
            height: $(document).context.documentElement.clientHeight - 20
        });

 

For some reason, this was causing the detail row to collapse.  Very strange behavior.  I'll look for an alternative way to size my grid.

Tags
Grid
Asked by
Coy
Top achievements
Rank 1
Answers by
Coy
Top achievements
Rank 1
Share this question
or