I am trying to use JQWidgets
in my ASP.net MVC
application but I don't see any data in JqxGrid
.
here is the view containing the grid
.
@model IEnumerable<jQWidgets.AspNet.Core.Models.Employee>
@{
ViewData["Title"] = "ASP .NET MVC Grid Example";
}
<label>ASP .NET Core MVC Grid Tag Helper Example</label><br/><br/>
<jqx-grid theme="@ViewData["Theme"]" sortable="true" filterable="true" autoheight="true" width="850" source="Model">
<jqx-grid-columns>
<jqx-grid-column columngroup="name" datafield="FirstName" width="100" text="First Name"></jqx-grid-column>
<jqx-grid-column columngroup="name" datafield="LastName" width="100" text="Last Name"></jqx-grid-column>
<jqx-grid-column datafield="Title" width="150"></jqx-grid-column>
<jqx-grid-column datafield="Address" width="200"></jqx-grid-column>
<jqx-grid-column datafield="City" width="150"></jqx-grid-column>
<jqx-grid-column datafield="Country"></jqx-grid-column>
</jqx-grid-columns>
<jqx-grid-column-groups>
<jqx-grid-column-group name="name" text="Name"></jqx-grid-column-group>
</jqx-grid-column-groups>
</jqx-grid>
And here is the controller that does return 5 employee records in the list.
public ActionResult Index()
{
return View(_context.Employees.ToList());
}
I see an empty jqxgrid
on the page.
All the required jqx scripts are added in the _layout.cshtml
file using Bundles
. Also, I have a similar grid on another page showing same information using Ajax/jquery which works just fine but I want to avoid using that way.