@model Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Models.TestGridModel
@using DevExtreme.AspNet.Mvc
@{
var contextId = Model;
// var gridId = $"dataGrid_{Guid.NewGuid():N}";
}
@(Html.DevExtreme().DataGrid()
.ID(Model.Id.ToString())
.ShowBorders(true)
.DataSource(ds => ds.Mvc()
.Controller("ManagementPage")
.LoadAction("GetShippings"))
.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("ShippingDate");
c.Add().DataField("LicencePlate");
c.Add().DataField("IsAllMeasured");
})
.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);
md.Template(@
<%- data.ShippingDate %> <%- data.LicencePlate %>'s shippingdocuments:
@(Html.DevExtreme().DataGrid()
.ColumnAutoWidth(true)
.ShowBorders(true)
.ID(new JS("'shippingDocumentGridContainer-' + data.Id"))
.Columns(columns => {
columns.AddFor(m => m.Id).AllowEditing(false);
columns.AddFor(m => m.Country);
columns.AddFor(m => m.Created);
columns.AddFor(m => m.PartnerId);
columns.Add()
.Caption("Completed")
.DataType(GridColumnDataType.Boolean)
.CalculateCellValue("calculateCellValue");
})
.DataSource(ds => ds.Mvc()
.Controller("Shipping")
.LoadAction("GetShippingDocumentsByShippingId")
.LoadParams(new { shippingId = new JS("data.Id") })
.Key("Id")
)
)
);
})
)