Well, I'm trying to get started with the Syncfusion Grid and I'm off to a frustrating start. I'm assuming this is something simple, as I'm not finding many other posts about this. I copied the List binding demo and tweaked it. However, despite everything working through the process, the EJ helper renders an empty <div> tag out to the browser.
Page Content:
@(Html.EJ().Grid<uploadedFile>("FilesGrid")
.Datasource(.Datasource((IEnumerable<object>)ViewBag.datasource))
.AllowSorting()
.AllowPaging()
.IsResponsive()
.Columns(col =>
{
col.Field("fileID").HeaderText("file ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
col.Field("fileName").HeaderText("File Name").TextAlign(TextAlign.Right).Priority(4).Width(75).Add();
col.Field("approvalID").HeaderText("approval ID").Width(80).Add();
col.Field("fileContents").HeaderText("File Contents").TextAlign(TextAlign.Right).Priority(4).Width(75).Add();
col.Field("comments").HeaderText("Comments").TextAlign(TextAlign.Right).Width(75).Priority(3).Format("{0:C}").Add();
col.Field("uploadDate").HeaderText("Upload Date").TextAlign(TextAlign.Right).Width(80).Priority(2).Format("{0:MM/dd/yyyy}").Add();
col.Field("uploadedBy").HeaderText("User").Width(110).Priority(2).Add();
col.Field("fileHash").HeaderText("File Hash").TextAlign(TextAlign.Right).Priority(4).Width(75).Add();
col.Field("fileType").HeaderText("File Type").TextAlign(TextAlign.Right).Priority(4).Width(75).Add();
}))
Controller Code:
public ActionResult FileListing()
{
using(FileUploadContext dbContext=new FileUploadContext())
{
ViewBag.datasource = dbContext.uploadedFiles.ToList();
}
return View();
}
The controller populates the datasource with around ten record, which I can step through on a debug do indeed get picked up by the EJ.Grid constructor. However, all that ever gets spit out to the page is: "<div id="FilesGrid"></div>"
I have all scripts and them files located in the project. Again, I'm sure it's something simple, but I'm not seeing it.
Any insight or help would be appreciated.