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

Signalr + Grid Detail Auto Collapsing

1 Answer 89 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paito
Top achievements
Rank 2
Paito asked on 12 Apr 2017, 04:16 PM

Hi,

I am currently using a Grid with a SignalR datasource and expandable rows to show a Detail Template, every time a new record is created in the grid from the server (onPush) it collapses any/all detail templates which you may have been viewing. Kinda annoying, any way to resolve this?

@(Html.Kendo().Grid<Models.MyView>()
    .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.Column1);
        columns.Bound(p => p.Column2);
    })
    .ClientDetailTemplateId("template")
    .Sortable()
    .Scrollable(s => s.Height("auto"))
    .Filterable()
    .Pageable()
    .Navigatable()
    .DataSource(dataSource => dataSource
        .SignalR()
        .AutoSync(true)
        .ServerFiltering(true)
        .ServerPaging(true)
        .ServerSorting(true)
        .ServerAggregates(true)
        .ServerGrouping(true)
        .PageSize(20)
        .Events(events => events.Push("onPush"))
        .Sort(s => s.Add("Posted").Descending())
        .Transport(tr => tr
            .Promise("hubStart")
            .Hub("hub")
            .Client(c => c
                .Read("read")
                .Create("create")
                .Update("update")
                .Destroy("destroy")
            )
            .Server(s => s
                .Read("read")
                .Create("create")
                .Update("update")
                .Destroy("destroy")
            )
        )
        .Schema(schema => schema
            .Data("Data")
            .Total("Total")
            .Aggregates("Aggregates")
            .Groups("Groups")
            .Model(model =>
            {
                model.Id("ID");
                model.Field("Column1", typeof(string));
                model.Field("Column2", typeof(string));
            })
        )
    )
)

<script id="template" type="text/kendo-tmpl">
   @(Html.Kendo().TabStrip()
            .Name("tabStrip_#=ID#")
            .SelectedIndex(0)
            .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
            .Items(items =>
            {
                items.Add().Text("Detail")
                    .LoadContentFrom("Detail", "Home", new { ID= "#=ID#" })
                    .Selected(true);
            })
            .ToClientTemplate())
</script>

 

Thanks!

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 17 Apr 2017, 06:51 AM
Hello ,

This can be achieved only with a custom logic to persist the expanded rows, and then to manually expanded them once the new data is set.

I can suggest checking the following example demonstrating this. The example is using a button to simulate refresh, but a similar logic can be used when a new data is set and the Grid is rebound:

http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/state/persist-expanded-rows

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
Tags
Grid
Asked by
Paito
Top achievements
Rank 2
Answers by
Stefan
Telerik team
Share this question
or