November Happy Hour will be moved to Thursday December 5th.

Create custom dojo widget that uses EPI's out-of-the-box link editor

Vote:
 

I have a custom dojo widget that displays a list of custom tags assigned to a page. When a user clicks a tag, I want to open a dialog box that shows the "create link" dialog.

Here's the code that I'm using to do that:

this.dialogContent = new LinkEditor({ });

this.isShowingChildDialog = true;

this.dialog = new Dialog({
                        title: "Select a page",
                        dialogClass: "epi-dialog-portrait",
                        content: this.dialogContent,
                        destroyOnHide: true
});

I can get the dialog box to come up correctly when I add static text to the "content" parameter, but it breaks with a console error when I try it like the above. The error that I get is that it "can't read properties of null." I'm thinking that LinkEditor needs to be preloaded with some parameters to fix this error. What are these parameters?

#176099
Mar 09, 2017 20:04
Vote:
 

Hi Tevin

You could try something like this:

this.dialogContent = new LinkEditor({
    modelType: this.metadata.additionalValues["modelType"],
    hiddenFields: ["text", "title", "target", "language"]
});

Don't forget this.own(this.dialogContent); before creating the dialog.

#176427
Mar 20, 2017 0:14
Vote:
 

Thanks, David!

I'm getting a console error of "cannot read property 'additionalValues' of undefined when I try that. Do I need to add something somewhere else in order to get it to work?

#176494
Mar 20, 2017 13:43
Vote:
 

Hi Tevin

I tried this in debug and you can try using:

'episerver.cms.shell.ui.objectediting.internalmetadata.linkmodel'    << quotes included

instead of 

this.metadata.additionalValues["modelType"]

David

#176506
Mar 20, 2017 14:49
James Wilkinson - Nov 27, 2019 17:16
This was a massive help for me today thanks David! I couldn't see anywhere this was documented, might be worth blogging it ;)
David Knipe - Nov 27, 2019 17:44
Ha its remarkable as I don't even remember answering this ;)! We always welcome and encourage and new bloggers if you fancied it Jay?

https://world.episerver.com/System/Blog-info/Create-Blog/
Vote:
 

Awesome, thank you! That worked.

#176531
Mar 20, 2017 17:07
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.