You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/filemanager/data-binding/hierarchical-data.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ This article explains how to bind the FileManager for Blazor to hierarchical dat
14
14
15
15
Hierarchical data means that the collection of child items is provided in a field of its parent's model:
16
16
17
-
* The `Items` field contains a collection of all children including sub-folders and files. They will be rendered in the [Preview Pane](slug:filemanager-preview-pane) when the parent folder is selected.
17
+
* The `Items` field contains a collection of all children including sub-folders and files. They will be rendered in the [FileManager View](slug:filemanager-views) when the parent folder is selected.
18
18
19
19
* The `Directories` field contains a collection of the subfolders of a directory. They will be rendered in the TreeView navigation pane. If there are `Directories` for a specific folder it will have an expand icon. The `HasDirectories` field can override this, however, but it is not required for hierarchical data binding.
Copy file name to clipboardExpand all lines: components/filemanager/data-binding/overview.md
+34-61Lines changed: 34 additions & 61 deletions
Original file line number
Diff line number
Diff line change
@@ -8,26 +8,20 @@ published: True
8
8
position: 0
9
9
---
10
10
11
-
# FileManager Data Binding Basics
11
+
# FileManager Data Binding Overview
12
12
13
-
This article explains the different ways to provide data to a FileManager component and the properties related to data binding. Reviewing this article will explain the basics of how you can describe the hierarchy of items in your data source to the treeview component so they can render.
13
+
This FileManager Data Binding section explains the different ways to provide data to a FileManager component and the properties related to data binding. This article describes what are the available (bindable) features of FileManager data items and how to map model properties to these features.
* The available (bindable) [features of a FileManager items](#filemanager-item-features).
20
-
* How to match fields in the model with the FileManager item [data bindings](#data-bindings).
15
+
There are two data binding modes that the FileManager supports:
21
16
22
-
There are two modes of providing data to a FileManager, and they both use the items' features. Once you are familiar with the current article, choose the data binding more you wish to use:
17
+
*[Flat data](slug:filemanager-data-binding-flat-data)—a collection of self-referencing items with parent-child relationships.
18
+
*[Hierarchical data](slug:filemanager-data-binding-hierarchical-data)—each item holds its children in a nested property.
23
19
24
-
*[Flat data](slug:filemanager-data-binding-flat-data) - a collection of self-referencing items with parent-child relationships See the `Id` and `ParentId` settings.
25
-
26
-
*[Hierarchical data](slug:filemanager-data-binding-hierarchical-data) - each item holds its children in a nested property. See the `Directories` setting.
The FileManager has features that map to properties in the model. The following model uses property names that will work automatically, with no additional FileManager configuration:
24
+
The FileManager extracts information about the displayed files and folders from properties in the model. The following flat data model uses property names that will work automatically, with no additional FileManager configuration:
31
25
32
26
````RAZOR
33
27
@using System.IO
@@ -225,62 +219,41 @@ The FileManager has features that map to properties in the model. The following
225
219
}
226
220
````
227
221
228
-
The above model properties have the following meaning for the FileManager:
229
-
222
+
The following section describes the meaning of the model properties for the FileManager.
|`IsDirectory`| Whether the item is a directory. If its value is `false` the item is considered a file and not a directory. |
241
-
|`DateCreated`| The creation date of the file. |
242
-
|`DateCreateUtc`| The creation date of the file in UTC. Required. |
243
-
|`DateModified`| The modification date of the file. |
244
-
|`DateModifiedUtc`| The modification date of the file in UTC. Required. |
245
-
|**Item relations**||
246
-
|`Id `| The unique identifier of the file. Required for [**binding to flat data**](slug:filemanager-data-binding-flat-data). |
247
-
|`ParentId`| Identifies the file's parent. Required for [**binding to flat data**](slug:filemanager-data-binding-flat-data). Set to `null` for root items. Do *not* use `ParentId` with hierarchical data. |
248
-
|`HasDirectories`| Determines whether the item has subdirectories. Required for binding to [**flat data**](slug:filemanager-data-binding-flat-data) If `true`, the directory will show an expand arrow. With [**hierarchical data**](slug:filemanager-data-binding-hierarchical-data), the FileManager renders expand icons based on `Directories`, but `HasDirectories` will take precedence. |
249
-
| `Directories` | Defines the item subdirectories. Required for [binding to **hierarchical data**](slug:filemanager-data-binding-hierarchical-data).
250
-
|`Items`| Defines all the subitems (directories and files) of the item. |
226
+
All [FileManager item features](#fileManager-item-features) map to model properties. You define that relationship by providing the property name from which the corresponding information is taken. To do this, use the following parameters of the main `TelerikFileManager` tag:
All [FileManager item features](#fileManager-item-features) map to model properties. The properties of a treeview item match directly to a field of the model the treeview is bound to. You provide that relationship by providing the name of the field from which the corresponding information is to be taken. To do this, in the main `TelerikFileManager` tag, use the parameters described below:
255
-
256
-
| FileManager Parameter | Default Value |
257
-
| --- | --- |
258
-
|**Item features**||
259
-
|`NameField`|`"Name"`|
260
-
|`SizeField`|`"Size"`|
261
-
|`PathField`|`"Path"`|
262
-
|`ExtensionField`|`"Extension"`|
263
-
|`IsDirectoryField`|`"IsDirectoryField"`|
264
-
|`DateCreatedField`|`"DateCreated"`|
265
-
|`DateCreateUtcField`|`"DateCreateUtc"`|
266
-
|`DateModifiedField`|`"DateModified"`|
267
-
|`DateModifiedUtcField`|`"DateModifiedUtc"`|
268
-
|**Item relations**||
269
-
|`IdField `|`"Id" `|
270
-
|`ParentIdField`|`"ParentId"`|
271
-
|`HasDirectoriesField`|`"HasDirectories"`|
272
-
|`DirectoriesField`|`"Directories"`|
273
-
|`EntriesField`|`"Entries"`|
274
-
275
-
>important Do not use `ParentId` with hierarchical data. This will confuse the FileManager that it is bound to flat data and the component may not render any items. If the model must have a `ParentId` property, set `ParentIdField` to a non-existent property.
230
+
| FileManager Parameter | Default Parameter Value <br /> (Model Property Name) | Model Property Type | Model Value Description |
231
+
| --- | --- | --- | --- |
232
+
|**Item features**||||
233
+
|`NameField`|`"Name"`|`string`| The name of the file or folder, excluding the extension. |
234
+
|`SizeField`|`"Size"`|`long`| The size of the file in bytes. |
235
+
|`PathField`|`"Path"`|`string`| The path to the item, including the name and extension. |
236
+
|`ExtensionField`|`"Extension"`|`string`| The item extension, starting with a dot `.`|
237
+
|`IsDirectoryField`|`"IsDirectory"`|`bool`| Whether the item is a folder. If `false`, it's treated as a file. |
238
+
|`DateCreatedField`|`"DateCreated"`|`DateTime`| The creation date of the file. |
239
+
|`DateCreatedUtcField`|`"DateCreatedUtc"`|`DateTime`| The creation date of the file in UTC. Required. |
240
+
|`DateModifiedField`|`"DateModified"`|`DateTime`| The modification date of the file. |
241
+
|`DateModifiedUtcField`|`"DateModifiedUtc"`|`DateTime`| The modification date of the file in UTC. Required. |
242
+
|**Item relations**||||
243
+
|`IdField `|`"Id" `| any | The unique identifier of the file. Required for [binding to flat data](slug:filemanager-data-binding-flat-data). |
244
+
|`ParentIdField`|`"ParentId"`| any | Identifies the item's parent. Required for [binding to flat data](slug:filemanager-data-binding-flat-data). Set to `null` for root items. Do not use `ParentId` with hierarchical data. |
245
+
|`HasDirectoriesField`|`"HasDirectories"`|`bool`| Determines whether the item has child folders. Required for [binding to flat data](slug:filemanager-data-binding-flat-data). If `true`, the folder will show an expand arrow in the TreeView. With [hierarchical data](slug:filemanager-data-binding-hierarchical-data), the FileManager renders expand icons based on `Directories`, but `HasDirectories` takes precedence. |
246
+
|`DirectoriesField`|`"Directories"`|`IEnumerable<TItem>`| The item's child folders to display in the TreeView. Required for [binding to hierarchical data](slug:filemanager-data-binding-hierarchical-data). |
247
+
|`ItemsField`|`"Items"`|`IEnumerable<TItem>`| The folder's child files and folders to display in the FileManager view. Required for [binding to hierarchical data](slug:filemanager-data-binding-hierarchical-data). |
248
+
249
+
>important Do not use `ParentId` with hierarchical data. This will confuse the FileManager that it is bound to flat data and the component may not render any items. If the model must have a `ParentId` property, set `ParentIdField` to a non-existent property name.
276
250
277
251
## Next Steps
278
252
279
-
Learn the different ways to provide data to a TreeView:
*[Use hierarchical data](slug:filemanager-data-binding-hierarchical-data) - each item holds its children in a nested property
253
+
Learn the different ways to provide data to a FileManager:
283
254
255
+
*[Use flat data](slug:filemanager-data-binding-flat-data), where all items at all levels represent a single collection.
256
+
*[Use hierarchical data](slug:filemanager-data-binding-hierarchical-data), where each folder item holds its child files and folders in nested properties.
0 commit comments