Custom Widget: Attribute name / value issue from XML

Hey guys, This issue has probably popped up quite some time and I only found 1 forum topic from 6 year back about this issue. And for me it seemed like I was missing some documentation for this (apparently my Googling skills are not as advanced :P). So Custom Widget I have a "name" attribute.  Now when I call the key in the custom widget I get "name" instead of "John Doe".  I've read something about using mxobject.get(key) which my widget responds to with "mxobject is not defined" Same for (where I need GUID not key).  I'm currently using: widget-base-master from Jelte Langedijk (JelteMX is GitHub). Package json name: mendix-widget-webpack, readme says it's part of "generator-mendix-widget".  Basically using " yarn run build " or " dev " to compile the widget. So I might be missing some "basic dojo/mx elements here as library input". 
2 answers

Hi Jermaine,

Cool that you are trying to use the widget-base in ES6 to build a widget. In order to get the value of this attribute, you will need to first get the context object.

I have an example here:

A more sophisticated example is the Leaflet Maps widget, you can find examples here:


mxobject.get(key) is correct. In order to get a reference to an mxobject you need either to do an first or get the object from the context i.e. this._contextObj

I always find it usefull to take a look at how other widget work when I am struggling with some part of the mendix client API. See for example -