Try our conversational search powered by Generative AI!

Templated Widget in Dojo / EPiServer CMS

Vote:
 

Hello fellow developers!

Im currently trying to develop a simple dojo widget for EPiServer CMS v 9.4 but I have run in to some troubles. 

The widget should contain a simple form, a button and a listing, but in the example below I have removed everything to just include the basic script and template, a minimal version that still does not work as it should

Script:

define([
"dojo/_base/declare",
"dijit/_WidgetBase",
"dijit/_TemplatedMixin",
"dojo/text!./templates/WidgetTemplate.html"
], function (declare, _WidgetBase, _TemplatedMixin, template) {
return declare([_WidgetBase, _TemplatedMixin], {
templateString: template
});
});

Template:

It's working...

Solution based on example here: https://dojotoolkit.org/documentation/tutorials/1.10/templated/ 

The issue is that when I try to load a page in Forms Edit Mode where this is used, nothing happens. It simply shows the loading bar on the button, but I get no console errors, and the forms view does not display.

Anyone who have seen this strange behavior before and have a clue as to what causes it?

Best regards

William

#192395
May 16, 2018 11:14
Vote:
 

Hi!

How does your EditorDescriptor look like? And the configuration in module.config?

#192454
May 17, 2018 8:28
Vote:
 

Editor descriptor:

[EditorDescriptorRegistration(TargetType = typeof(string), UIHint = UIHint)]
public class PushFormEditorDescriptor : EditorDescriptor
{
     public const string UIHint = "PushFormEditorDescriptor";

     public PushFormEditorDescriptor()
     {
          ClientEditingClass = "push/Editor";
     }
}

Config:

<dojoModules>
     <add name="tags" path="Tags" />
     <add name="vimeo" path="Scripts/widgets" />
     <add name="push" path="Push" />
</dojoModules>

Descriptor usage:

[EditorDescriptor(EditorDescriptorType = typeof(PushFormEditorDescriptor))]
[Display(Name = "Pushformulär",
    Description = "",
    Order = 5,
    GroupName = "Information")]
public virtual string PushForm { get; set; }



#192523
May 18, 2018 9:18
Vote:
 

Well I solved it by myself :) I missed the following override in the EditorDescriptor

public override void ModifyMetadata(EPiServer.Shell.ObjectEditing.ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
{
     ClientEditingClass = "push/Editor";
     base.ModifyMetadata(metadata, attributes);
}



#192599
May 21, 2018 9:10
* 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.