@(Html.EJ().Grid<>
("AllPayments")
//Grouping
.AllowGrouping()
.GroupSettings(group => { group.EnableDropAreaAutoSizing(false); })
//Paging
.AllowPaging()
.PageSettings(ps => { ps.PageCount(1); ps.PageSize(1000); })
//Sorting
.AllowSorting()
//.SortSettings(sort => sort.SortedColumns(col => col.Field("FromDate").Direction(SortOrder.Descending).Add()))
//Filtering
.AllowFiltering()
.FilterSettings(filter => { filter.FilterType(Syncfusion.JavaScript.FilterType.Excel); })
//Selection
.AllowSelection()
.SelectionType(SelectionType.Multiple)
.SelectionSettings(select => { select.SelectionMode(mode => { mode.AddMode(SelectionMode.Row); }); })
//Responsive
.IsResponsive(true)
// .EnableResponsiveRow(true)
//Resizing
//.AllowResizing()
//.TextWrapSettings(wrap => { wrap.WrapMode(WrapMode.Both); })
//.ColumnLayout(ColumnLayout.Fixed)
//.ResizeSettings(resize => resize.ResizeMode(ResizeMode.Normal))
//Mapping
//.Mappers(map => map.ExportToWordAction("ExportToWord"))
//Scrolling
//.AllowScrolling()
//.ScrollSettings(col => {col.AllowVirtualScrolling(true).VirtualScrollMode(VirtualScrollMode.Continuous); })
//Persistance
//.EnablePersistence(true)
//Editing
.EditSettings(edit => {
edit.AllowEditing();
edit.AllowAdding();
edit.AllowDeleting();
edit.EditMode(EditMode.Normal);
})
.ContextMenuSettings(contextMenu =>
{
if (HttpContext.Current.User.IsInRole("PaymentAuth"))
{
contextMenu.EnableContextMenu();
contextMenu.DisableDefaultItems()
.CustomContextMenuItems(new List<CustomContextMenuItems>()
{
new CustomContextMenuItems() { Id = "CustContextAmmend", Text = "Ammend Value" },
new CustomContextMenuItems() { Id = "CustContextAddRem", Text = "Add or Remove Payment Lines" },
new CustomContextMenuItems() { Id = "CustContextApprove", Text = "Approve Payment" },
new CustomContextMenuItems() { Id = "CustContextReject", Text = "Reject Payment" },
new CustomContextMenuItems() { Id = "CustContextAudit", Text = "Show Audit" },
});
}
})
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar()
.ToolbarItems(items =>
{
items.AddTool(ToolBarItems.Search);
});
})
.Columns(col =>
{
col.Field("Id").Visible(false).IsPrimaryKey(true).Add();
col.Field("PAymentURN").HeaderText("Payment URN").AllowEditing(false).Add();
col.Field("PaymentStatus").HeaderText("Payment Status").AllowEditing(false).Add();
col.Field("CollaboratorName").HeaderText("Collaborator").AllowEditing(false).Add();
col.Field("ColaboratorAxNum").HeaderText("Finance System Number").AllowEditing(false).Add();
col.Field("Value").HeaderText("Value").Format("{0:c2}").AllowEditing(false).EditType(EditingType.NumericEdit).NumericEditOptions(new EditorProperties() { DecimalPlaces = 2 }).Add();
col.Field("CreatedDate").HeaderText("Created Date").Format("{0:dd/MM/yyyy}").AllowEditing(false).Add();
col.Field("UpdatedDate").HeaderText("Updated Date").Format("{0:dd/MM/yyyy}").AllowEditing(false).Add();
}).ChildGrid(child =>
{
child.Datasource(ds => ds.URL("/Payment/Payment/AdditionalPaymentDataSource").Adaptor(AdaptorType.UrlAdaptor).Offline(false))
.QueryString("Id")
.AllowPaging()
.Locale("en-GB")
.AllowSorting()
.SortSettings(sort => sort.SortedColumns(col => col.Field("Value").Direction(SortOrder.Descending).Add()))
.PageSettings(page => page.PageSize(5))
.Columns(col =>
{
col.Field("Id").Visible(false).Add();
col.Field("ParentPaymentId").Visible(false).Add();
col.Field("PaymentRate").HeaderText("Payment Rate").Add();
col.Field("RequestURN").HeaderText("Request URN").Add();
col.Field("Value").HeaderText("Value").Format("{0:c2}").Add();
col.Field("Notes").HeaderText("Notes").Add();
});
})
.ClientSideEvents(eve => eve.RecordDoubleClick("recordDoubleClick"))
.ClientSideEvents(eve=> eve.DataBound("DataBound"))
)