Can we create dojo declarative(not programatic) titlePane inside template based widget?

StackOverflow https://stackoverflow.com/questions/23561617

  •  18-07-2023
  •  | 
  •  

문제

Can we create dojo declarative titlePane inside template based widget?

When I am creating a titlePane out side the template file like :

It is working, but as soon as I have moved this code to html template file it is not working. (I am attachiong this file to dojo widget)

도움이 되었습니까?

해결책

You should be able to add widgets in your template yes. There are only a few things you have to remind:

  • You can not use a widget as the root element of the template,
  • You should inherit from the dijit/_WidgetsInTemplateMixin as well,
  • Like all declarative markup, you still have to include the module itself (dijit/TitlePane), by adding it either to your require() or define(). For example:
declare("my/Widget", [ _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin ], {
    title: "My title",
    content: "My content",
    templateString: "<div>" +
    "<div data-dojo-type=\"dijit/TitlePane\" data-dojo-props=\"title: '${title}'\">${content}</div>" +
    "</div>"
});

I also made an example JSFiddle.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top