@model Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Models.TestGridModel @using DevExtreme.AspNet.Mvc @Html.AntiForgeryToken()
@( Html.DevExtreme().DataGrid() .ID("orderDataGridContainer") .ShowBorders(true) .DataSource(ds => ds.Mvc() .Controller("ManagementPage") .LoadAction("GetShippingDocuments")) .KeyExpr("Id") .SearchPanel(sp => sp.Visible(true)) .HeaderFilter(hf => hf.Visible(true)) .Paging(p => p.PageSize(15)) .Pager(p => p.Visible(true)) .OnRowExpanded("onRowExpanded") .Editing(editing => { editing.Mode(GridEditMode.Cell); editing.AllowUpdating(true); editing.AllowAdding(true); editing.AllowDeleting(true); }) .Columns(c => { c.Add().DataField("Id").AllowEditing(false); c.Add().DataField("PartnerId") .AllowEditing(true) .Lookup(lookup => lookup .DataSource(d => d.Mvc().Controller("ManagementPage").LoadAction("GetAllPartners").Key("Id")) .ValueExpr("Id") .DisplayExpr("Name") ) .EditCellTemplate(new TemplateName("DropDownBoxTemplate")) .Width(150); c.Add() .Caption("Items in order") .DataType(GridColumnDataType.Number) .CalculateCellValue("calculateItemsCount").AllowEditing(false); @* c.Add().DataField("PartnerId"); *@ c.Add().DataField("DocumentIdNumber"); c.Add().DataField("IsAllMeasured").AllowEditing(false); c.Add() .Caption("Completed") .DataType(GridColumnDataType.Boolean) .CalculateCellValue("calculateCellValue").AllowEditing(false); }) .Toolbar(toolbar => { toolbar.Items(items => { items.Add() .Name("addRowButton") .ShowText(ToolbarItemShowTextMode.Always); items.Add() .Location(ToolbarItemLocation.After) .Widget(w => w.Button() .Text("Delete Selected Records") .Icon("trash") .Disabled(true) .OnClick("onDeleteBtnClick") ); }); }) .MasterDetail(md => md.Enabled(true).Template(new TemplateName("masterDetailTemplate")) ) )
@using (Html.DevExtreme().NamedTemplate("masterDetailTemplate")) {
<%- data.ShippingDate %> <%- data.LicencePlate %>'s shipping documents:
@if (Model.ChildGrids != null && Model.ChildGrids.Any()) {
@if (Model.Configuration.ShowChildGridsAsTabs) {
@for (int i = 0; i < Model.ChildGrids.Count; i++) { var child = Model.ChildGrids[i]; var isActive = i == 0 ? "show active" : "";
@* Initial load - will be replaced by AJAX on first tab click *@
Loading...
}
}
} } @using(Html.DevExtreme().NamedTemplate("DropDownBoxTemplate")) { @(Html.DevExtreme().DropDownBox() .DataSource(d => d.Mvc().Controller("ManagementPage").LoadAction("GetAllPartners").Key("Id")) .Value(new JS("value")) .ValueExpr("Id") .InputAttr("aria-label", "Partner") .DisplayExpr("Name") .DropDownOptions(options => options.Width(500)) .Option("setValue", new JS("setValue")) .ContentTemplate(new TemplateName("ContentTemplate")) ) } @using(Html.DevExtreme().NamedTemplate("ContentTemplate")) { @(Html.DevExtreme().DataGrid() .DataSource(d => d.Mvc().Controller("ManagementPage").LoadAction("GetAllPartners").Key("Id")) .RemoteOperations(true) .Height(250) .Columns(c => { c.Add().DataField("Name"); c.Add().DataField("Country"); c.Add().DataField("TaxId"); }) .Scrolling(s => s.Mode(GridScrollingMode.Virtual)) .HoverStateEnabled(true) .Selection(s => s.Mode(SelectionMode.Single)) .SelectedRowKeys(new JS("component.option('value') !== undefined && component.option('value') !== null ? [component.option('value')] : []")) .FocusedRowEnabled(true) .FocusedRowKey(new JS("component.option('value')")) .OnContextMenuPreparing("function(e) { e.items = [] }") .OnSelectionChanged("function(e) { onPartnerSelectionChanged(e, component) }") ) }