In my razor view I have the following
@model IEnumerable<ObjectType>
@{
Layout = "~/Views/Admin/_AdminLayout.cshtml";
}
<div class="containter">
@(Html.EJ().Grid<ObjectType>("Details")
.Datasource(ds => ds.Json(Model)
.UpdateURL("EditData")
.InsertURL("AddData")
.RemoveURL("NormalDelete")
.Adaptor(AdaptorType.RemoteSaveAdaptor))
.AllowGrouping()
.EnableHeaderHover()
.EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); })
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.Add);
items.AddTool(ToolBarItems.Edit);
items.AddTool(ToolBarItems.Delete);
items.AddTool(ToolBarItems.Update);
items.AddTool(ToolBarItems.Cancel);
});
})
.AllowPaging()
.AllowScrolling()
// .GroupSettings(group =>
// {
// group.GroupedColumns(col => { col.Add("1" }).EnableDropAreaAnimation(false);
// })
.Columns(col =>
{
col.Field("1").ToString())
.HeaderText("1").ToString())
.IsPrimaryKey(true)
.TextAlign(TextAlign.Right)
.Visible(false)
.Add();
col.Field("2").ToString())
.HeaderText("2")
.Add();
col.Field("3")
.HeaderText("3")
.Add();
col.Field("4")
.HeaderText("4")
.TextAlign(TextAlign.Right)
.Add();
col.Field("5")
.HeaderText("5")
.Add();
col.Field("6")
.HeaderText("6")
.Add();
})
)
</div>
The Page loads and the data is displayed. Paging Works and the Editing / Adding works as well. But when I try to group the columns I get the following javascript error
ej.web.all.min.js:10 Uncaught DataManger : a dataSource is required to create Manager
Error: DataManger : a dataSource is required to create Manager
at u (http://localhost:36348/Scripts/ej/ej.web.all.min.js:10:70811)
at Object.t.DataManager (http://localhost:36348/Scripts/ej/ej.web.all.min.js:10:20276)
at Object.t.gridFeatures.group._setAggregates (http://localhost:36348/Scripts/ej/ej.web.all.min.js:10:1477102)
at Object.t.widget._ensureDataSource (http://localhost:36348/Scripts/ej/ej.web.all.min.js:10:1522954)
at Object.t.gridFeatures.common._processBindings (http://localhost:36348/Scripts/ej/ej.web.all.min.js:10:1290350)
at Object.t.gridFeatures.group.groupColumn (http://localhost:36348/Scripts/ej/ej.web.all.min.js:10:1464622)
at Object.r.ejDroppable.drop (http://localhost:36348/Scripts/ej/ej.web.all.min.js:10:1478050)
at Object.t.widget._drop (http://localhost:36348/Scripts/ej/ej.web.all.min.js:10:85818)
at HTMLDivElement.proxy (http://localhost:36348/Scripts/jquery-1.10.2.js:841:14)
at HTMLDivElement.jQuery.event.dispatch (http://localhost:36348/Scripts/jquery-1.10.2.js:5109:9)