Error: Activate edit widget from query result click

1018
6
Jump to solution
08-29-2016 11:25 AM
Hoang_YenHa
New Contributor II

Robert Scheitlin, GISP

I've been having hard time making your codes work with WAB 2.1

I placed the modified codes to SingleQueryResult.js (in stead of widget.js)

and the error I got is "TypeError: WidgetManager.getInstance is not a function".  

This question is related to the one you helped me before.

https://community.esri.com/message/622158?commentID=622158#comment-622158 

Much appreciated!

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Hoang,

   The link I posted in my last reply is a good place to start. Knowing that order matters is a basic step in knowing AMD coding patterns.

Now I have "TypeError: this._combineRadioCheckBoxWithLabel is not a function"

This likely means you do not have a  _combineRadioCheckBoxWithLabel function in that js file then. 

I notice 'jimu/dijit/LoadingShelter' is not included in function().  Why is that one different from others?

Anything that you need to require in your code if you are not using it problematically in your code but are only using it in your Widget.html, then you do not need to declare a corresponding var for that require. The whole importance of a having requires and the their proceeding vars in order is so that the var (i.e. WidgetManager is linked to the require "jimu/WidgetManager"). 

View solution in original post

6 Replies
RobertScheitlin__GISP
MVP Emeritus

Have you added the require for WidgetManager?

0 Kudos
Hoang_YenHa
New Contributor II

I'm not sure if I understand your question.  I have this ?

I've attached my SingleQueryResult.js.

/*RJS - Added the next two lines*/
'jimu/WidgetManager',
'jimu/PanelManager',
/*RJS - end Add*/
'./SingleQueryLoader',
'./RelatedRecordsResult',
'jimu/dijit/LoadingShelter'
],
function(declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, Evented, template, lang, query,
html, array, Deferred, esriLang, QueryTask, FeatureSet, symbolJsonUtils, PopupTemplate, PopupRenderer,
RelationshipQuery, jimuUtils, jimuSymbolUtils, Message, PopupMenu, BaseFeatureAction, LayerInfos,
FeatureActionManager, SingleQueryLoader, RelatedRecordsResult,
//added
WidgetManager, PanelManager) {
//end add

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Hoang,

   But they are not in the right order.

The abc’s of AMD | ArcGIS Blog 

Your code should look like this:

/*RJS - Added the next two lines*/
'jimu/WidgetManager',
'jimu/PanelManager',
/*RJS - end Add*/
'./SingleQueryLoader',
'./RelatedRecordsResult',
'jimu/dijit/LoadingShelter'
],
function(declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, Evented, template, lang, query,
html, array, Deferred, esriLang, QueryTask, FeatureSet, symbolJsonUtils, PopupTemplate, PopupRenderer,
RelationshipQuery, jimuUtils, jimuSymbolUtils, Message, PopupMenu, BaseFeatureAction, LayerInfos,
FeatureActionManager, WidgetManager, PanelManager, SingleQueryLoader, RelatedRecordsResult
) {

Hoang_YenHa
New Contributor II

Gosh I never knew order matters!  Could you please recommend some good books for me to learn from ground up ?

Back to my question.  Now I have "TypeError: this._combineRadioCheckBoxWithLabel is not a function"  when I do query.

Oh one more question.  I notice 'jimu/dijit/LoadingShelter' is not included in function().  Why is that one different from others?

Thankyou,

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Hoang,

   The link I posted in my last reply is a good place to start. Knowing that order matters is a basic step in knowing AMD coding patterns.

Now I have "TypeError: this._combineRadioCheckBoxWithLabel is not a function"

This likely means you do not have a  _combineRadioCheckBoxWithLabel function in that js file then. 

I notice 'jimu/dijit/LoadingShelter' is not included in function().  Why is that one different from others?

Anything that you need to require in your code if you are not using it problematically in your code but are only using it in your Widget.html, then you do not need to declare a corresponding var for that require. The whole importance of a having requires and the their proceeding vars in order is so that the var (i.e. WidgetManager is linked to the require "jimu/WidgetManager"). 

Hoang_YenHa
New Contributor II

I got it Robert!  Thank you! Thank you! Thank you!

0 Kudos