@{Html.EJ().Grid<Object>("FlatGrid")
.Datasource(ds => ds.Json((IEnumerable<object>)ViewBag.data).UpdateURL("/Home/CellEditUpdate").InsertURL("/Home/CellEditInsert").RemoveURL("/Home/CellEditDelete").Adaptor(AdaptorType.RemoteSaveAdaptor))
.AllowPaging()
.AllowResizeToFit()
.AllowTextWrap()
.TextWrapSettings(wrap => { wrap.WrapMode(WrapMode.Both); })
.AllowSorting()
.AllowScrolling()
.ScrollSettings(col => { col.Width(1800).Height(460); })
.AllowSelection()
.SelectionType(SelectionType.Single)
.IsResponsive(true)
.EnableResponsiveRow(true)
.AllowFiltering()
.FilterSettings(filter => { filter.FilterType(FilterType.Excel); })
.EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); })
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.Edit);
items.AddTool(ToolBarItems.Update);
//items.AddTool(ToolBarItems.Delete);
});
})
.Columns(col =>
{
col.Field("Id").HeaderText("Id").IsPrimaryKey(true).Visible(false).Add();
col.Field("Cabin").HeaderText("Cabin").AllowEditing(false).Width(100).Add();
col.Field("Line").HeaderText("Line").AllowEditing(false).AllowResizing().Width(100).Add();
col.Field("Turbine").HeaderText("Turbine").AllowEditing(false).AllowResizing().Width(100).Add();
col.Field("StatusCode").HeaderText("Status code").AllowEditing(false).AllowResizing().Width(150).Add();
col.Field("AlarmDescription").HeaderText("Main fault description").AllowEditing(false).AllowResizing().Width(150).Add();
col.Field("AddnAllarmDescription").HeaderText("Additional fault description").AllowEditing(false).AllowResizing().Width(150).Add();
col.Field("FalckTaxonomy").HeaderText("Allocated taxonomy").AllowEditing(false).AllowResizing().Width(150).Add();
col.Field("Timekey").HeaderText("Timekey").AllowEditing(false).AllowResizing().Width(125).Add();
col.Field("dt_from").HeaderText("Start Date").Format("{0:dd/MM/yyyy HH:mm:ss}").AllowEditing(false).AllowResizing().Width(150).Add();
col.Field("dt_to").HeaderText("End Date").Format("{0:dd/MM/yyyy HH:mm:ss}").AllowEditing(false).AllowResizing().Width(150).Add();
col.Field("KindofActivity").HeaderText("Kind of Activity").EditType(EditingType.Dropdown).DataSource((IEnumerable<object>)ViewBag.kindofactivities).AllowResizing().Width(150).Add();
col.Field("ReasonDescription").HeaderText("Reason Description").AllowResizing().Width(150).Add();
col.Field("MA_StatusCode").HeaderText("Reallocated status code").AllowEditing(true).EditType(EditingType.Dropdown).DataSource((IEnumerable<object>)ViewBag.alarms).ForeignKeyField("MA_StatusCode").AllowResizing().Width(150).Add();
//col.Field("Reallocated_FaultDescription").HeaderText("Reallocated Fault Description").EditType(EditingType.Dropdown).DataSource((List<object>)ViewBag.alarms1).AllowResizing().Width(150).Add();
//col.Field("Reallocated_AddFaultDescription").HeaderText("Reallocated Add Fault Description").EditType(EditingType.Dropdown).DataSource((List<object>)ViewBag.alarms2).AllowResizing().Width(150).Add();
//col.Field("Reallocated_Taxonomy").HeaderText("Reallocated Taxonomy").AllowEditing(false).AllowResizing().Width(150).Add();
col.Field("FullDescription").HeaderText("Reallocated Full Description").EditType(EditingType.Dropdown).DataSource((IEnumerable<object>)ViewBag.FullAlarm).ForeignKeyField("FullDescription").AllowResizing().Width(400).Add();
col.Field("timekey_changed").HeaderText("Timekey Changed").EditType(EditingType.Numeric).ValidationRules(v => v.AddRule("range", "[1,6]").AddRule("required", true)).Width(150).Add();
col.Field("Timekey_ReasonDescription").HeaderText("Timekey Reason Description").AllowResizing().Width(150).Add();
col.Field("Unallocated_alarms_flag").HeaderText("Unallocated_alarms_flag").AllowResizing().Visible(false).Width(150).Add();
col.Field("ServiceCompany").HeaderText("Service Company").EditType(EditingType.Dropdown).DataSource((IEnumerable<object>)ViewBag.service).AllowResizing().Width(150).Add();
col.Field("Responsability").HeaderText("Responsability").AllowResizing().Width(150).Add();
col.Field("sk_plant").HeaderText("sk_plant").AllowResizing().Visible(false).Add();
}).Render();
}