Skip to content

Commit af037b6

Browse files
pharret31alexslavr
andauthored
TreeView: update VirtualMode demo to use NetCore endpoints (DevExpress#31071)
Co-authored-by: alexlavrov <[email protected]>
1 parent c75490a commit af037b6

File tree

8 files changed

+39
-39
lines changed

8 files changed

+39
-39
lines changed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<dx-tree-view
22
[dataSource]="dataSource"
33
dataStructure="plain"
4-
keyExpr="Id"
5-
displayExpr="Name"
4+
keyExpr="ID"
5+
displayExpr="Text"
66
parentIdExpr="CategoryId"
77
hasItemsExpr="IsGroup"
8+
[rootValue]="null"
89
[virtualModeEnabled]="true"
910
></dx-tree-view>

apps/demos/Demos/TreeView/VirtualMode/Angular/app/app.component.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { NgModule, Component, enableProdMode } from '@angular/core';
22
import { BrowserModule } from '@angular/platform-browser';
33
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
44
import { DxTreeViewModule } from 'devextreme-angular';
5-
import { DataSource, ODataStore } from 'devextreme-angular/common/data';
5+
import * as AspNetData from 'devextreme-aspnet-data-nojquery';
66

77
if (!/localhost/.test(document.location.host)) {
88
enableProdMode();
@@ -19,11 +19,9 @@ if (window && window.config?.packageConfigPaths) {
1919
templateUrl: `.${modulePrefix}/app.component.html`,
2020
})
2121
export class AppComponent {
22-
dataSource = new DataSource({
23-
store: new ODataStore({
24-
version: 2,
25-
url: 'https://js.devexpress.com/Demos/WidgetsGallery/odata/HierarchicalItems',
26-
}),
22+
dataSource = AspNetData.createStore({
23+
loadUrl: 'https://js.devexpress.com/Demos/NetCore/api/TreeViewPlainData',
24+
key: 'ID',
2725
});
2826
}
2927

apps/demos/Demos/TreeView/VirtualMode/React/App.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
import React from 'react';
22
import TreeView from 'devextreme-react/tree-view';
33

4-
import { DataSource, ODataStore } from 'devextreme-react/common/data';
4+
import AspNetData from 'devextreme-aspnet-data-nojquery';
55

6-
const dataSource = new DataSource({
7-
store: new ODataStore({
8-
version: 2,
9-
url: 'https://js.devexpress.com/Demos/WidgetsGallery/odata/HierarchicalItems',
10-
}),
6+
const dataSource = AspNetData.createStore({
7+
loadUrl: 'https://js.devexpress.com/Demos/NetCore/api/TreeViewPlainData',
8+
key: 'ID',
119
});
1210
const App = () => (
1311
<React.Fragment>
1412
<TreeView
1513
dataSource={dataSource}
1614
dataStructure="plain"
17-
keyExpr="Id"
18-
displayExpr="Name"
15+
keyExpr="ID"
16+
displayExpr="Text"
1917
parentIdExpr="CategoryId"
2018
hasItemsExpr="IsGroup"
2119
virtualModeEnabled={true}
20+
rootValue={null}
2221
/>
2322
</React.Fragment>
2423
);

apps/demos/Demos/TreeView/VirtualMode/ReactJs/App.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
import React from 'react';
22
import TreeView from 'devextreme-react/tree-view';
3-
import { DataSource, ODataStore } from 'devextreme-react/common/data';
3+
import AspNetData from 'devextreme-aspnet-data-nojquery';
44

5-
const dataSource = new DataSource({
6-
store: new ODataStore({
7-
version: 2,
8-
url: 'https://js.devexpress.com/Demos/WidgetsGallery/odata/HierarchicalItems',
9-
}),
5+
const dataSource = AspNetData.createStore({
6+
loadUrl: 'https://js.devexpress.com/Demos/NetCore/api/TreeViewPlainData',
7+
key: 'ID',
108
});
119
const App = () => (
1210
<React.Fragment>
1311
<TreeView
1412
dataSource={dataSource}
1513
dataStructure="plain"
16-
keyExpr="Id"
17-
displayExpr="Name"
14+
keyExpr="ID"
15+
displayExpr="Text"
1816
parentIdExpr="CategoryId"
1917
hasItemsExpr="IsGroup"
2018
virtualModeEnabled={true}
19+
rootValue={null}
2120
/>
2221
</React.Fragment>
2322
);

apps/demos/Demos/TreeView/VirtualMode/Vue/App.vue

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,20 @@
44
:data-source="dataSource"
55
:virtual-mode-enabled="true"
66
data-structure="plain"
7-
key-expr="Id"
8-
display-expr="Name"
7+
key-expr="ID"
8+
display-expr="Text"
99
parent-id-expr="CategoryId"
1010
has-items-expr="IsGroup"
11+
:root-value="null"
1112
/>
1213
</div>
1314
</template>
1415
<script setup lang="ts">
15-
import { DataSource, ODataStore } from 'devextreme-vue/common/data';
1616
import DxTreeView from 'devextreme-vue/tree-view';
17+
import { createStore } from 'devextreme-aspnet-data-nojquery';
1718
18-
const dataSource = new DataSource({
19-
store: new ODataStore({
20-
version: 2,
21-
url: 'https://js.devexpress.com/Demos/WidgetsGallery/odata/HierarchicalItems',
22-
}),
19+
const dataSource = createStore({
20+
loadUrl: 'https://js.devexpress.com/Demos/NetCore/api/TreeViewPlainData',
21+
key: 'ID',
2322
});
2423
</script>

apps/demos/Demos/TreeView/VirtualMode/jQuery/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<script src="../../../../node_modules/jquery/dist/jquery.min.js"></script>
99
<link rel="stylesheet" type="text/css" href="../../../../node_modules/devextreme-dist/css/dx.light.css" />
1010
<script src="../../../../node_modules/devextreme-dist/js/dx.all.js"></script>
11+
<script src="../../../../node_modules/devextreme-aspnet-data/js/dx.aspnet.data.js"></script>
1112
<script src="data.js"></script>
1213
<script src="index.js"></script>
1314
</head>
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
$(() => {
22
$('#simple-treeview').dxTreeView({
3-
dataSource: new DevExpress.data.DataSource({
4-
store: new DevExpress.data.ODataStore({
5-
version: 2,
6-
url: 'https://js.devexpress.com/Demos/WidgetsGallery/odata/HierarchicalItems',
7-
}),
3+
dataSource: DevExpress.data.AspNet.createStore({
4+
loadUrl: 'https://js.devexpress.com/Demos/NetCore/api/TreeViewPlainData',
5+
key: 'ID',
86
}),
97
dataStructure: 'plain',
10-
keyExpr: 'Id',
11-
displayExpr: 'Name',
8+
keyExpr: 'ID',
9+
displayExpr: 'Text',
1210
parentIdExpr: 'CategoryId',
1311
hasItemsExpr: 'IsGroup',
1412
virtualModeEnabled: true,
13+
rootValue: null,
1514
});
1615
});

apps/demos/menuMeta.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5738,6 +5738,10 @@
57385738
"Title": "Virtual Mode",
57395739
"Name": "VirtualMode",
57405740
"Widget": "TreeView",
5741+
"Modules": "devextreme-aspnet-data-nojquery",
5742+
"MvcAdditionalFiles": [
5743+
"/Controllers/ApiControllers/TreeViewPlainDataController.cs"
5744+
],
57415745
"DemoType": "Web"
57425746
}
57435747
]

0 commit comments

Comments
 (0)