We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Grid doesn't show any rows

I'm trying to get started with EJ/MVC and, to be honest, having a lot of trouble. I created a new MVC app, and followed the instructions here for how to make it into a Syncfusion app. I'm using Entity Framework with "code first" modeling.

I have a model:

    public class Group
    {
        public Guid GroupID { get; set; }
        public string Name { get; set; }
        public int SortOrder { get; set; }
    }

and a controller/view, scaffolded by the "add controller" menu, to which I added a grid:

@model IEnumerable<WebApplication4.Models.Group>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>

@(Html.EJ().Grid<WebApplication4.Models.Group>("GridContainer")
        .Datasource(Model)
        .Columns(col =>
        {
            col.Field("GroupID").HeaderText("ID").Add();
            col.Field("Name").HeaderText("Name").Add();
            col.Field("SortOrder").HeaderText("Order").Add();

        })
        .AllowPaging()                                                                                                              
)

<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Name)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.SortOrder)
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.SortOrder)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.GroupID }) |
            @Html.ActionLink("Details", "Details", new { id=item.GroupID }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.GroupID })
        </td>
    </tr>
}

</table>

I used the "create new" button to add a couple of rows. The rows show up in the scaffolded table, but the grid only shows the header & footer. It obviously knows that there ARE rows, as it says "2 items" in the footer. If I look at the page source, the rendered table just has a <tr> with empty <td>s in it.

I'm assuming that there is something simple and/or fundamental that I'm missing... any suggestions?

brian

3 Replies

RU Ragavee U S Syncfusion Team October 18, 2016 09:27 AM UTC

Hi Brian, 

Thanks for your interest in Syncfusion products. 

We have created a sample with Entity Framework Code-First approach and we are sorry that the issue is not reproduced at our end. The sample can be downloaded from the below location. 


Please try the above sample and if you still face any difficulties, please share the following details for our reference. 

1.       Video demo of the issue that you are facing. 
2.       Is there any script error or exception obtained? If so, please share the expanded screenshot of the error. 
3.       Essential studio version and browser version details 
4.       If possible, please reproduce the issue in the above provided sample and share. 

Regards, 
Ragavee U S. 



RB R Brian Lindahl October 18, 2016 06:25 PM UTC

Turns out I was failing to include jsrender.min.js on my page. With it, it displays just fine. Thanks!


RU Ragavee U S Syncfusion Team October 19, 2016 06:50 AM UTC

Hi Brian, 
  
Thanks for your update. 
 
We are happy that your issue is resolved. 
  
Regards, 
Ragavee U S. 


Loader.
Live Chat Icon For mobile
Up arrow icon