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

kendo grid paging not work - "No items to display"

1 Answer 32 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mohammad reza
Top achievements
Rank 1
mohammad reza asked on 23 Nov 2020, 08:58 PM

hi.

i wrote a module for Orchardcore Cms  and use telerik kendo grid for asp.net core. i added kendo resource to my "ResourceManifest" class and use it in "index.cshtml" file:

public class ResourceManifest : IResourceManifestProvider
    {
        public void BuildManifests(IResourceManifestBuilder builder)
        {
            var manifest = builder.Add();
            manifest
                .DefineScript("kendo1")
                .SetUrl("~/PMS/Assets/lib/kendo/js/kendo.all.min.js");
            manifest
                .DefineScript("kendo2")
                .SetUrl("~/PMS/Assets/lib/kendo/js/kendo.core.min.js");
            manifest
                .DefineScript("kendo3")
                .SetUrl("~/PMS/Assets/lib/kendo/js/kendo.data.min.js");
            manifest
                .DefineScript("kendo4")
                .SetUrl("~/PMS/Assets/lib/kendo/js/kendo.aspnetmvc.min.js");
          manifest
                .DefineStyle("kendo1-style")
                .SetUrl("~/PMS/Assets/lib/kendo/css/web/kendo.bootstrap-v4.min.css");
            manifest
                .DefineStyle("kendo2-style")
                .SetUrl("~/PMS/Assets/lib/kendo/css/web/kendo.nova.min.css");
        }
    }

 


and index.cshtml:

 

@using Kendo.Mvc.UI
 
@addTagHelper *, OrchardCore.ResourceManagement
 
<style asp-name="kendo1-style"></style>
 
<script asp-name="jQuery" at="Head"></script>
<script asp-name="kendo1" depends-on="jQuery"></script>
<script asp-name="kendo2" depends-on="jQuery"></script>
<script asp-name="kendo3" depends-on="jQuery"></script>
<script asp-name="kendo4" depends-on="jQuery"></script>
 
<div class="k-rtl">
     @(Html.Kendo().Grid<PMS.ViewModels.PersonsViewModel>
    ()
    .Name("Grid")
    .Columns(columns =>
    {
    columns.Bound(name => name.Fullname).Title("name");
    columns.Bound(name => name.PersonalID).Title("code");
 
    })
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()
    .HtmlAttributes(new { style = "height:430px;" })
    .DataSource(dataSource => dataSource
    .Ajax()
    .PageSize(5)
    .Model(model =>
    {
    model.Id(p => p.ID);
    })
    .Read(read => read.Action("Persons_Read", "Persons").Data("sendAntiForgery"))
            ))
         
 
    </div>

and this is my controller:

[AcceptVerbs("Post")]
       public async Task<ActionResult> Persons_Read([DataSourceRequest] DataSourceRequest request)
       {
           var ret = await Getpersons().ToDataSourceResultAsync(request);
           return Json(ret);
       }

 

 

all things is ok. no javascript error and total item of request is 1157 records but kendo grid is not show page numbers and  "No items to display" message show on buttom of grid!!!

plz help.

thanks.

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 26 Nov 2020, 02:41 PM

Hello Mohammad,

The provided Grid configuration looks in order to me.

Could you please modify the attached project so that I can observe the behavior? I will then test it and see what is causing the problem.

Looking forward to your reply.

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
mohammad reza
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or