-
Notifications
You must be signed in to change notification settings - Fork 1
/
GridViewPartialView.cshtml
45 lines (45 loc) · 2.19 KB
/
GridViewPartialView.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
@{
var grid = Html.DevExpress().GridView(settings =>
{
settings.Name = "Grid";
settings.CallbackRouteValues = new { Controller = "Home", Action = "GridViewPartialView" };
settings.SettingsEditing.BatchUpdateRouteValues = new { Controller = "Home", Action = "BatchUpdateRoomsPartial" };
settings.SettingsEditing.Mode = GridViewEditingMode.Batch;
settings.SettingsPager.PageSize = 5;
settings.SettingsBehavior.AllowSort = false;
settings.ClientSideEvents.BatchEditStartEditing = "OnBatchEditStartEditing";
settings.ClientSideEvents.BatchEditRowDeleting = "OnBatchEditRowDeleting";
settings.ClientSideEvents.BatchEditRowInserting = "OnBatchEditRowInserting";
settings.CommandColumn.Visible = true;
settings.CommandColumn.ShowDeleteButton = true;
settings.CommandColumn.ShowNewButtonInHeader = true;
settings.Width = 400;
settings.KeyFieldName = "ID";
settings.Columns.Add("Number");
settings.Columns.Add("Floor");
settings.Columns.Add(column =>
{
column.FieldName = "IsReserved";
column.ColumnType = MVCxGridViewColumnType.CheckBox;
column.EditorProperties().CheckBox(p =>
{
p.ClientSideEvents.CheckedChanged = "OnCellCheckedChanged";
p.ValidationSettings.Display = Display.Dynamic;
});
column.SetHeaderTemplateContent(c =>
{
ViewContext.Writer.Write("<div style='text-align:center;'>");
Html.DevExpress().CheckBox(headerCheckBoxSettings =>
{
headerCheckBoxSettings.Name = "HeaderCheckBox";
headerCheckBoxSettings.Properties.AllowGrayed = true;
headerCheckBoxSettings.Properties.AllowGrayedByClick = false;
headerCheckBoxSettings.Properties.ClientSideEvents.CheckedChanged = "OnHeaderCheckBoxCheckedChanged";
headerCheckBoxSettings.Properties.ClientSideEvents.Init = "OnInitHeader";
}).GetHtml();
ViewContext.Writer.Write("</div>");
});
});
});
}
@grid.Bind(Model).GetHtml()