Skip to content

Commit 15ba84f

Browse files
Merge example changes from main branch
2 parents 9d263c0 + a4aeaeb commit 15ba84f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+39362
-147
lines changed
Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
1-
@using ASP_NET_Core.Models
2-
3-
<h2>Home</h2>
4-
5-
@(Html.DevExtreme().DataGrid<SampleOrder>()
6-
.ShowBorders(true)
7-
.DataSource(d => d.Mvc().Controller("SampleData").LoadAction("Get").Key("OrderID"))
8-
.Columns(columns => {
9-
columns.AddFor(m => m.OrderID);
10-
columns.AddFor(m => m.OrderDate);
11-
columns.AddFor(m => m.CustomerName);
12-
columns.AddFor(m => m.ShipCountry);
13-
columns.AddFor(m => m.ShipCity);
1+
<div class="demo-header">
2+
<h3>DataGrid - Select multiple items and drag'n'drop</h3>
3+
<div id="toggle-container">
4+
<span>Clear selection after drop</span>
5+
@(Html.DevExtreme().Switch().ID("clearAfterDropSwitch"))
6+
</div>
7+
</div>
8+
@(Html.DevExtreme().TabPanel()
9+
.Items(tabs => {
10+
tabs.Add().Title("Plain Data")
11+
.Template(@<text>
12+
<div>
13+
@(await Html.PartialAsync("../PartialViews/DataGridLocal"))
14+
</div>
15+
</text>);
16+
tabs.Add().Title("Hierarchical Data")
17+
.Template(@<text>
18+
<div>
19+
@(await Html.PartialAsync("../PartialViews/DataGridRemote"))
20+
</div>
21+
</text>);
1422
})
15-
.Paging(p => p.PageSize(10))
16-
.FilterRow(f => f.Visible(true))
17-
.HeaderFilter(f => f.Visible(true))
18-
.GroupPanel(p => p.Visible(true))
19-
.Grouping(g => g.AutoExpandAll(false))
20-
.RemoteOperations(true)
21-
.Summary(s => s
22-
.TotalItems(totalItems => {
23-
totalItems.AddFor(m => m.ShipCity).SummaryType(SummaryType.Count);
24-
})
25-
.GroupItems(groupItems => {
26-
groupItems.Add().SummaryType(SummaryType.Count);
27-
})
28-
)
2923
)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@(
2+
Html.DevExtreme().DataGrid()
3+
.DataSource(new JS("customers"))
4+
.KeyExpr("ID")
5+
.RowDragging(drag => drag
6+
.AllowReordering(true)
7+
.OnDragStart("LocalGrid.dragStart")
8+
.OnDragChange("LocalGrid.dragChange")
9+
.OnReorder("LocalGrid.reorder")
10+
.DragTemplate(new JS("LocalGrid.dragTemplate"))
11+
)
12+
.Selection(s => s.Mode(SelectionMode.Multiple))
13+
.Sorting(s => s.Mode(GridSortingMode.None))
14+
.Columns(col => {
15+
col.Add().DataField("ID").Width(55);
16+
col.Add().DataField("CompanyName");
17+
col.Add().DataField("Address");
18+
col.Add().DataField("City");
19+
col.Add().DataField("State");
20+
})
21+
)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
@(
2+
Html.DevExtreme().DataGrid()
3+
.DataSource(d => d.RemoteController()
4+
.LoadUrl("https://js.devexpress.com/Demos/Mvc/api/RowReordering/Tasks")
5+
.UpdateUrl("https://js.devexpress.com/Demos/Mvc/api/RowReordering/UpdateTask")
6+
.OnBeforeSend("RemoteGrid.beforeSend")
7+
.Key("ID"))
8+
.RemoteOperations(true)
9+
.RowDragging(drag => drag
10+
.AllowReordering(true)
11+
.OnDragStart("RemoteGrid.dragStart")
12+
.OnDragChange("RemoteGrid.dragChange")
13+
.OnReorder("RemoteGrid.reorder")
14+
.DragTemplate(new JS("RemoteGrid.dragTemplate"))
15+
)
16+
.Selection(s => s.Mode(SelectionMode.Multiple))
17+
.Sorting(s => s.Mode(GridSortingMode.None))
18+
.Scrolling(s => s.Mode(GridScrollingMode.Virtual))
19+
.Height(480)
20+
.Columns(columns => {
21+
columns.Add().DataField("ID").Width(55);
22+
columns.Add().DataField("Owner").Lookup(lookup => lookup
23+
.DataSource(d => d.RemoteController()
24+
.LoadUrl("https://js.devexpress.com/Demos/Mvc/api/RowReordering/Employees")
25+
.Key("ID"))
26+
.ValueExpr("ID")
27+
.DisplayExpr("FullName")
28+
);
29+
columns.Add().DataField("AssignedEmployee")
30+
.Width(150)
31+
.Caption("Assignee")
32+
.Lookup(lookup => lookup
33+
.DataSource(d => d.RemoteController()
34+
.LoadUrl("https://js.devexpress.com/Demos/Mvc/api/RowReordering/Employees")
35+
.Key("ID"))
36+
.ValueExpr("ID")
37+
.DisplayExpr("FullName")
38+
);
39+
columns.Add().DataField("Subject");
40+
})
41+
)

ASP.NET Core/Views/Shared/_Layout.cshtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<link rel="stylesheet" href="~/css/vendor.css" asp-append-version="true" />
1818
<link rel="stylesheet" href="~/css/Site.css" />
1919
<script src="~/js/vendor.js" asp-append-version="true"></script>
20+
<script src="~/js/LocalDataArray.js"></script>
21+
<script src="~/js/GridLocal.js"></script>
22+
<script src="~/js/GridRemote.js"></script>
2023
</head>
2124

2225
<body class="dx-viewport">

ASP.NET Core/wwwroot/css/Site.css

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,35 @@
11
.demo-container {
2-
margin: 50px;
3-
width: 90vw;
2+
margin: 50px 50px;
3+
width: 90vh;
44
}
55
body {
66
margin: 8px;
77
}
8+
.tab-item-content {
9+
margin: auto;
10+
}
11+
12+
.demo-header {
13+
display: flex;
14+
justify-content: space-between;
15+
}
16+
17+
#toggle-container {
18+
padding-top: 20px;
19+
}
20+
21+
#clearAfterDropSwitch {
22+
vertical-align: text-bottom;
23+
}
24+
25+
#toggle-container span {
26+
padding-right: 10px;
27+
}
28+
29+
.drag-container {
30+
padding: 10px;
31+
}
32+
33+
.drag-container td {
34+
padding: 0px 10px 0px 10px;
35+
}
166 KB
Binary file not shown.
83.7 KB
Binary file not shown.
62.8 KB
Binary file not shown.
168 KB
Binary file not shown.
83.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)