Hi,
I am trying to get me MVC grid to render, but I keep getting a javascript error. My code is as below
@section Styles {
<link rel='nofollow' href="~/Content/ej/web/bootstrap-theme/ej.web.all.min.css" rel="stylesheet" />
<link rel='nofollow' href="~/Content/ej/web/responsive-css/ejgrid.responsive.css" rel="stylesheet" />
}
@section scripts{
@Html.EJ().ScriptManager()
@Scripts.Render("~/Scripts/ej/common/ej.core.min.js")
@Scripts.Render("~/Scripts/ej/common/ej.data.min.js")
@Scripts.Render("~/Scripts/ej/web/ej.pager.min.js")
@Scripts.Render("~/Scripts/ej/common/ej.scroller.min.js")
@Scripts.Render("~/Scripts/ej/web/ej.waitingpopup.min.js")
@Scripts.Render("~/Scripts/ej/web/ej.grid.min.js")
}
@(Html.EJ().Grid<SkyExpress.Web.ViewModels.NewsViewModel>("newsgrid")
.Datasource(ds => ds.URL(Url.Action("NewsDataSource", "News"))
.Adaptor(AdaptorType.UrlAdaptor))
.AllowPaging()
.AllowSorting()
.AllowSearching()
.SelectionType(SelectionType.Single)
.EnableRowHover()
.EnableAltRow()
.AllowResizing()
.AllowResizeToFit()
.IsResponsive(true)
.EnableResponsiveRow(true)
.AllowTextWrap(true)
//.EnablePersistence()
.ClientSideEvents(e => { e.RecordDoubleClick("newsObject.onViewClick"); })
.ClientSideEvents(e => { e.DataBound("newsObject.bindGridEditButtons"); })
.ClientSideEvents(e => { e.ActionComplete("newsObject.bindGridEditButtons"); })
//.ToolbarSettings(toolbar => { toolbar.ShowToolbar(true).ToolbarItems(items => { items.AddTool(ToolBarItems.Search); }); })
.Columns(col =>
{
col.Field("NewsId").IsPrimaryKey(true).Visible(false).Add();
col.Field("Title").HeaderText("Title").ClipMode(ClipMode.EllipsisWithTooltip).Width(200).Priority(1).Add();
col.Field("NewsDate").HeaderText("News Date").Format("{0: MM/dd/yyyy}").Priority(2).Add();
col.Field("AuthorName").HeaderText("Author").ClipMode(ClipMode.EllipsisWithTooltip).Priority(6).Add();
col.Field("isPublished").HeaderText("Published").Visible(true).HeaderTextAlign(TextAlign.Left).Priority(3).TextAlign(TextAlign.Center).Add();
col.Field("PublishedBy").HeaderText("Published By").ClipMode(ClipMode.EllipsisWithTooltip).Visible(true).Priority(6).Add();
col.Field("PublishedDate").HeaderText("Published Date").Format("{0: MM/dd/yyyy}").Visible(true).Priority(3).Add();
col.Field("isActive").HeaderText("Active").Visible(true).HeaderTextAlign(TextAlign.Left).Priority(3).TextAlign(TextAlign.Center).Add();
col.HeaderText("Manage").Width(145).AllowTextWrap(false).TextAlign(TextAlign.Center).AllowSorting(false).Priority(1)
//.Format("<div class='btn-group btn-group-sm' name='ManageButtons'><button type='button' name='btnViewModal' class='btn btn-primary' title='View'><i class=\"fa fa-eye\" aria-hidden=\"true\"></i> </button><button type='button' name='btnEditModal' class='btn btn-primary' title='Edit'><i class=\"fa fa-pencil-square-o\" aria-hidden=\"true\"></i> </button><button type='button' name='btnDeleteUser' class='btn btn-primary' title='Delete'><i class=\"fa fa-trash\" aria-hidden=\"true\"></i> </button></div>")
.Format("<div class='btn-group btn-group-sm' name='ManageButtons'><button type='button' name='btnViewModal' class='btn btn-primary' title='View'><i class=\"fa fa-eye\" aria-hidden=\"true\"></i> </button><button type='button' name='btnEditModal' class='btn btn-primary' title='Edit'><i class=\"fa fa-pencil-square-o\" aria-hidden=\"true\"></i> </button></div>")
.Add();
})
)
The error I get on the client side is shown below and the grid does not render.
If i use @Scripts.Render("~/Scripts/ej/web/ej.web.all.min.js") then my grid works just fine. But I do not want to use "ej.web.all.min.js" as it is more than 10mb in size.
What am I doing wrong?
Thanks