The attribute table widget has a function _switchTable which toggles attribute table. I would like to call it from a off panel widget. I looked into Communication between widgets- but it provides methods to fetchData. I am little confused. Any thoughts? Robert, have done anything in this line?
Thanks in advance
Solved! Go to Solution.
Ann,
Ahh, now I see what you were saying about the on event handler. So the issue I see in your code is that _AttributeTable is likely out of scope inside your on event handler. So you need to use lang.htich to get around that.
var _AttributeTable = this.widgetManager.getWidgetsByName("AttributeTable");
html.setAttr(this.domNode, 'title', this.label);
d = domConstruct.create('div');
on(d, 'click', lang.hitch(this, function{
_AttributeTable._switchTable();
}),d);
Or you can use:
this._AttributeTable = this.widgetManager.getWidgetsByName("AttributeTable");
html.setAttr(this.domNode, 'title', this.label);
d = domConstruct.create('div');
on(d, 'click', function{
this._AttributeTable._switchTable();
},d);
Ann,
So do you know how to get a reference to the AT widget in your widget?
Yes, like this ?: var _AttributeTable = this.widgetManager.getWidgetsByName("AttributeTable");
Ann,
Then all you have to do is call the method from the _AttributeTable var then.
Thanks Robert. That's the part which confused me to implement in "on" click event.
Ann,
The on click event in the AT widget just calls that function so all you need to do is call that same fruntion:
_AttributeTable._switchTable();
Thanks Robert. That part I got- but my "on" implementation is getting wrong. Actually, I was trying to modify a sample code something like this:
var _AttributeTable = this.widgetManager.getWidgetsByName("AttributeTable");
html.setAttr(this.domNode, 'title', this.label);
d = domConstruct.create('div');
on(d, 'click', function{
_AttributeTable._switchTable();
},d);
Ann,
Ahh, now I see what you were saying about the on event handler. So the issue I see in your code is that _AttributeTable is likely out of scope inside your on event handler. So you need to use lang.htich to get around that.
var _AttributeTable = this.widgetManager.getWidgetsByName("AttributeTable");
html.setAttr(this.domNode, 'title', this.label);
d = domConstruct.create('div');
on(d, 'click', lang.hitch(this, function{
_AttributeTable._switchTable();
}),d);
Or you can use:
this._AttributeTable = this.widgetManager.getWidgetsByName("AttributeTable");
html.setAttr(this.domNode, 'title', this.label);
d = domConstruct.create('div');
on(d, 'click', function{
this._AttributeTable._switchTable();
},d);
Thanks Robert. Learning curve is little steep that I thought. But, you are very helpful. Dojo is a strange world with less help. Most of the books are written before 2011. And, there are no good tutorials except one in Pluralsight which is off topic. Sitepen is no longer doing anything with Dojo. So, what's the suggestion on how to get speed on WAB development? Please share your expertise. Thanks
Ann,
Look at existing widgets and try to follow the code paths that they take. When you see something that you don't understand like "this.own" or "lang.hitch" search the web for dojo docs on those. Dojo is not going away so I am not sure about:
Sitepen is no longer doing anything with Dojo