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
{{ message }}
This repository was archived by the owner on Feb 10, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: docs/developers-guide-v2.md
+21-3Lines changed: 21 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -180,7 +180,9 @@ else
180
180
#### DocTypeGridEditorViewComponent
181
181
Behind the scenes, Doc Type Grid Editor uses a ViewComponent to render all items. You can let it use the default component for all your editors if you like, but you can also specify your own document type specific, or editor specific view component. Or specify your own default view component.
182
182
183
-
If you are not the type of developer that likes to put business logic in your views, then the ability to seperate logic from your view is a must. To render your grid editor item with a document type or editor specific view component, you need to create a view component, and give it a name in the format `{DocTypeAlias or EditorAlias}DocTypeGridEditorViewComponent`.
183
+
If you are not the type of developer that likes to put business logic in your views, then the ability to seperate logic from your view is a must. To render your grid editor item with a document type or editor specific view component, you need to create a view component, and give it a name in the format `{EditorAlias or Document Type Alias}DocTypeGridEditorViewComponent`.
184
+
185
+
Note: The name of the viewcomponent is case sensitive, but DTGE is helpful enough to look for view components starting both with an uppercase letter and lowercase letter of your alias.
184
186
185
187
The view component must implement a method called Invoke taking a dynamic model parameter, and a viewPath parameter as a string. The method should return an IViewComponentResult. As an example, the default view component does this:
186
188
@@ -192,9 +194,25 @@ public IViewComponentResult Invoke(dynamic model, string viewPath)
192
194
```
193
195
194
196
#### Overriding the default view component
195
-
Doc Type Grid Editor comes with a default view component, that simply takes the model of the editor and sends it to the correct view. If you want to override this viewcomponent.
197
+
Doc Type Grid Editor comes with a default view component, that simply takes the model of the editor and sends it to the correct view. If you want to override this ViewComponent and replace it with your own, you can do it in your Startup.cs file, in the ConfigureServices method.
198
+
199
+
Add the following code, to configure DocTypeGridEditor:
0 commit comments