Grid Only Shows 1 Page Until Filtered

3 posts, 0 answers
  1. Graham
    Graham avatar
    9 posts
    Member since:
    Jul 2012

    Posted 15 Apr 2015 Link to this post

    My grid shows only 1 page of data until I apply a filter and then clear it. Having done that, it instantly shows all 28 pages.

     

    1. does anyone have any idea what might be causing this?

     

    2. is there any way to get it to recalculate the page list at the bottom of the grid after loading using a javascript command?

     

    Here is the grid:

     

        @(Html.Kendo().Grid<tpnconnect.com.AdminService.DeviceDataEdit>()
            .Name("deviceGrid")
            .Columns(columns =>
            {
                columns.Bound(d => d.DepotNumber).Width(60);
                columns.Bound(d => d.DeviceName).Width(150);
                columns.Bound(d => d.DeviceAlias).Width(150);
                columns.Bound(d => d.AutoMode).Width(100).Title("Auto Mode").EditorTemplateName("AutoMode").ClientTemplate("#:AutoModeDisplay#");
                columns.Bound(d => d.CreatedDate).Title("Created").Format("{0:dd-MMM-yy HH:mm}").Width(80);
                columns.Bound(d => d.Active).Width(40).Filterable(true);
                columns.Command(command => { command.Edit(); command.Destroy(); }).Width(160);
            })
            .ToolBar(toolbar => toolbar.Create())
            .Editable(editable => editable.Mode(GridEditMode.InLine))
            .Pageable()
            .Sortable()
            .Filterable()
            .Scrollable()
            .HtmlAttributes(new { style = "height:430px;" })
            .DataSource(dataSource => dataSource
                .Ajax()
                .Model(model => model.Id(d => d.DeviceID))
                .PageSize(20)
                .ServerOperation(false)
                .Events(events => events.Error("error_handler"))
                .Create(update => update.Action("AddDevice", "Printer"))
                .Read(read => read.Action("GetAllDevicesForEdit", "Printer"))
                .Update(update => update.Action("UpdateDevice", "Printer"))
                .Destroy(update => update.Action("DeleteDevice", "Printer"))
            )
        )

  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 17 Apr 2015 Link to this post

    Hi Graham,

    I am not sure what exactly is causing this, but I suspect that the Read Controller returns data in format different than the expected. For example: 
    AggregateResults: null
    Data: […]
    Errors: null
    Total: 123
    I would recommend inspecting the network traffic either in the browser's network tab or using Fiddler to confirm if that is indeed the case. Also, sharing the GetAllDevicesForEdit implementation would allow us investigate further.

    Regards,
    Alexander Popov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Graham
    Graham avatar
    9 posts
    Member since:
    Jul 2012

    Posted 21 Jul in reply to Alexander Popov Link to this post

    Apologies for the delay replying: you were right - there was a missing field in the data.

     

    btw - the date of the posts above should be Apr 2016, not Apr 2015.

Back to Top