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

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
  • Member since: 2008

    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
  • 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
  • Member since: 2008

    Hi Tevin

    I tried this in debug and you can try using:

    ''    << quotes included

    instead of 



    #176506 Mar 20, 2017 14:49
  • Awesome, thank you! That worked.

    #176531 Mar 20, 2017 17:07