Hi,
I'm creating a new widget class for dinamically sellecting some data from a list of records provided and retrieving it to a custom widget.
I have called this new widget class MyFieldsSelect and I created two files, one for the code (.js) and other for the template (.html) and placed them inside the folder of my custom widget.
Here is the begining code of my MyFieldsSelect.js:
<SPAN class="token function">define</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">[</SPAN>
<SPAN class="string token">'dojo/_base/declare'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">'dijit/_WidgetBase'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">'dijit/_WidgetsInTemplateMixin'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">'dojo/text!./MyFieldsSelect.html'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">'dojo/_base/lang'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">'dojo/on'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">'dojo/dom-style'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">'dojo/dom-attr'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">'dojo/dom-construct'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">'dojo/_base/array'</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="string token">'./FieldSelector'</SPAN>
<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN>
<SPAN class="keyword token">function</SPAN> <SPAN class="punctuation token">(</SPAN>declare<SPAN class="punctuation token">,</SPAN> _WidgetBase<SPAN class="punctuation token">,</SPAN> _WidgetsInTemplateMixin<SPAN class="punctuation token">,</SPAN>
MyFieldsSelectTemplate<SPAN class="punctuation token">,</SPAN> lang<SPAN class="punctuation token">,</SPAN> on<SPAN class="punctuation token">,</SPAN> domStyle<SPAN class="punctuation token">,</SPAN>
domAttr<SPAN class="punctuation token">,</SPAN> domConstruct<SPAN class="punctuation token">,</SPAN> array<SPAN class="punctuation token">,</SPAN> FieldSelector<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">var</SPAN> clazz <SPAN class="operator token">=</SPAN> <SPAN class="token function">declare</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">[</SPAN>_WidgetBase<SPAN class="punctuation token">,</SPAN> _WidgetsInTemplateMixin<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">{</SPAN>
baseClass<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">'jimu-widget-MyFieldsSelect-setting'</SPAN><SPAN class="punctuation token">,</SPAN>
templateString<SPAN class="punctuation token">:</SPAN> MyFieldsSelectTemplate<SPAN class="punctuation token">,</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>I used _WidgetBase because it was the only way I manage to define a constructor method and work properly with the arguments passed in the instantiation of an object of this class.
My problem is that I'am not being able to access the data-dojo-attach-points that I defined in my template (MyFieldsSelect.html), and, when I try to access an element through this.myElementDataDojoAttachPointName, it says it is undefined, although the variable templateString returns the content of my template file as text.
Any ideas on how to correct this?
Thanks