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

Grid Paging Error

1 Answer 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 28 Jan 2016, 01:19 AM

I'm using a Kendo UI Grid in conjunction with two AutoComplete widgets.  Everything mostly works perfectly, however, if a user pages through the grid and then does a search using one of the AutoComplete widgets, the grid does not display the data.  The pager at the bottom of the grid is updated but the grid is blank.  The user must click on a page before the data is displayed.  I have not been able to find a setting to resolve this despite hours of Googling.  Here's the code for my grid: 

@(Html.Kendo().Grid(Model)
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(a => a.EmployeeOI).Visible(false);
            columns.Bound(a => a.DepartmentOI).Visible(false);
            columns.Bound(a => a.LevelId).Width(60).Title("Level");
            columns.Bound(a => a.DepartmentName).Width(150).Title("Department");
            columns.Bound(a => a.EmployeeId).Width(60).Title("Emp");
            columns.Bound(a => a.BuyerName).Width(100).Title("Buyer Name");
            columns.Bound(a => a.MinAmount).Width(100).Title("Min Amt");
            columns.Bound(a => a.MaxAmount).Width(100).Title("Max Amt");
            columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
        })
        .ToolBar(toolbar => toolbar.Create())
        .Editable(editable => editable.Mode(GridEditMode.PopUp))
        .Pageable()
        .Sortable(s => s
            .AllowUnsort(false)
            .SortMode(GridSortMode.MultipleColumn))
    .Scrollable()
    .HtmlAttributes(new { style = "height:650px;, width:100%" })
    .DataSource(dataSource => dataSource
        .Ajax()
        .Sort(x => x.Add(y => y.LevelId).Ascending())
        .Sort(x => x.Add(y => y.MaxAmount).Ascending())
        .ServerOperation(false)
        .PageSize(8)
        .Events(events => events.Error("error_handler"))
        .Read(read => read.Action("Read", "Home").Data("gridAddlData"))
        .Create(update => update.Action("EditingPopup_Create", "Home"))
        .Update(update => update.Action("EditingPopup_Update", "Home"))
        .Destroy(update => update.Action("EditingPopup_Destroy", "Home"))
      .Model(m =>
      {
          m.Id(i => i.Id);
          m.Id(i => i.EmployeeOI);
          m.Id(i => i.DepartmentOI);
          m.Field("LevelID", typeof(string));
          m.Field("EmployeeId", typeof(string));
          m.Field("BuyerName", typeof(string));
          m.Field("MinAmount", typeof(decimal));
          m.Field("MaxAmount", typeof(decimal));
          m.Field("DepartmentId", typeof(string));
      })
      )
    )

1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 29 Jan 2016, 08:12 AM
Hi Richard,

Thank you for contacting us.

To avoid the described behavior you can try setting the grid pager to page one just before changing the datasource. For example:
$("#grid").data("kendoGrid").dataSource.page(1);
On the following link I created a small example which demonstrates this approach:
http://dojo.telerik.com/AFOYIl

Please give it try and let me know if it helps you.

If you need further assistance, do not hesitate to contact us again.

Regards,
Radoslav
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or