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

Grid showing no records after sort

1 Answer 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 17 Jun 2016, 06:03 PM

I have a simple Kendo UI grid setup for serverside processing which displays some employee information.  The grid displays just fine when i first load the view but as soon as you click on a column to sort it refreshes and just gives me an empty grid.  The Action is firing each time a column header is click and is returning the correct amount of records to the view.  See my code below:

View:

@ModelType List(Of ConnectEntities.Employee)
 
@Code
    ViewData("Title") = "CompanyDirectory"
    Layout = "~/Views/Shared/_HomeLayout.vbhtml"
 
End Code
 
 
    <div class="row">
 
        <div class="col-md-12">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h4>Company Directory</h4>
 
                </div>
                <div class="panel-body">
                    @Code
                        Html.Kendo.Grid(Of ConnectEntities.Employee)() _
                                                    .Name("employeeDirectory") _
                                                    .BindTo(DirectCast(ViewData("employees"), IEnumerable(Of ConnectEntities.Employee))) _
                                    .Columns(Sub(c)
                                                 c.Bound(Function(p) p.FirstName_AD).Sortable(True)
                                                 c.Bound(Function(p) p.LastName_AD)
                                                 c.Bound(Function(p) p.JobTitle_AD)
                                                 c.Bound(Function(p) p.PhoneNumber_AD)
 
                                             End Sub) _
                                                                                     .DataSource(Sub(d)
                                                                                                     d.Server() _
                                                                                                     .Read(Function(read) read.Action("Person_Read", "Home"))
 
                                                                                                 End Sub) _
                                                                                     .Sortable() _
                                                                                     .Filterable() _
                        .Render()
 
 
 
                    End Code
 
 
                </div>
            </div>
        </div>
    </div>

 

Controller Code:

Function CompanyDirectory() As ActionResult
 
    Dim employees As List(Of ConnectEntities.Employee)
 
    Using connectDB As New ConnectEntities.ConnectEntities
        employees = connectDB.Employees.ToList
    End Using
 
    ViewData("employees") = employees
 
    Return View()
 
 
End Function

 

Public Function Person_Read() As ActionResult
 
 
    Dim employees As List(Of ConnectEntities.Employee)
 
    Using connectDB As New ConnectEntities.ConnectEntities
        employees = connectDB.Employees.ToList
    End Using
 
    Return View("CompanyDirectory", employees)
 
 
End Function

 

 

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 21 Jun 2016, 04:40 PM
Hello,

The code looks correct, therefore in order to assist you in resolving this problem please isolate it in a runnable project and send it to us via support ticket, so we can debug it locally and see what is causing the unexpected behavior.

Regards,
Pavlina
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
Andrew
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or