Out of the box, DTGE will use the "name" from the entry in the "grid.editors.config.js" file. Our docs gives an example of "Doc Type", (which I guess you are using?), so that's what it will show.
You can create custom previews for the DTGE cells. You could try this...
Set the enablePreview to true.
In the folder (that the previewViewPath is pointing at), create a Razor .cshtml file, with the filename of what your alias value would be. If you're following our docs, then it could be docType.cshtml (This is case-insensitive, if you want to call it DocType.cshtml).
I created the file: /Views/Partials/Grid/Editors/DocTypeGridEditor/Previews/docType.cshtml with your sample code, but all my DTGE properties in the backoffice still say Features in the header.
Could you please explain what the "nameTemplate" property does? I don't see any mention of it in the Developer Guide.
How do I show the document type label in the grid?
When adding content to the grid using the DTGE, I want the name of my document type to appear on the grid instead of just 'DocType' for everything.
Is this not a current feature or am I just missing something?
Hi Matthew,
Out of the box, DTGE will use the "name" from the entry in the "grid.editors.config.js" file. Our docs gives an example of "Doc Type", (which I guess you are using?), so that's what it will show.
You can create custom previews for the DTGE cells. You could try this...
Set the
enablePreview
totrue
.In the folder (that the
previewViewPath
is pointing at), create a Razor.cshtml
file, with the filename of what youralias
value would be. If you're following our docs, then it could bedocType.cshtml
(This is case-insensitive, if you want to call itDocType.cshtml
).For the contents of the Razor file...
Try this as an example:
I hope this helps?
Cheers,
- Lee
Thanks, Lee.
I wasn't able to get previews to work with your example. Below is the config I'm using:
I created the file:
/Views/Partials/Grid/Editors/DocTypeGridEditor/Previews/docType.cshtml
with your sample code, but all my DTGE properties in the backoffice still say Features in the header.Could you please explain what the "nameTemplate" property does? I don't see any mention of it in the Developer Guide.
The
nameTemplate
is for if you want to use any of the doctype's property values in the name/label. e.g. you could do"Blah {{propertyAlias}}"
.Yeah, our docs need updating, (same old reason, there's not enough hours in the day).
If that makes sense?
Cheers,
- Lee
nameTemplate doesn't appear to do anything. When I change it to "Widget: {{propertyAlias}}" it still shows the name value How do I get this to work?
As a workaround, I have the following in the preview /Previews/docType.cshtml
That didn't work for me either, just literally outputs the text xxxx {{propertyAlias}}
is working on a reply...