I need to ask you one more thing... The class @XxxFeatureAction derive from BaseFeatureAction.
Can you explain me about isFeatureSupported and onExecute function?
How can I send data ( a featureSet.fields.values() ) from this class to Widget.js.
This line make that:
myWidget.showVertexCount(featureSet.fields.values());
in Widget.js
showVertexCount: function(count){
this.vertexCount.innerHTML = 'The vertex count is: ' + count;
}
this method receives that information.
I've been trying to print that but it shows me null. I don't know why.
Do you understand me?
Thanks a lot
Solved! Go to Solution.
Rolando,
The isFeatureSupported method is where you write your code to determine if this feature action should be available. So if you want your feature action to only be available for a specific layer then you would use the optional Layer parameter of that method to determine if you are working with the correct layer. The isFeatureSupported has FeatureSet property and an optional Layer property.
As far as sending data back to a widget I would use a global var in your widget to pass the info. You mention that you are trying that already, but which out seeing your code I could not tell you what you are doing wrong (are you sure you have a true widget object as your myWidget var?).
Rolando,
The isFeatureSupported method is where you write your code to determine if this feature action should be available. So if you want your feature action to only be available for a specific layer then you would use the optional Layer parameter of that method to determine if you are working with the correct layer. The isFeatureSupported has FeatureSet property and an optional Layer property.
As far as sending data back to a widget I would use a global var in your widget to pass the info. You mention that you are trying that already, but which out seeing your code I could not tell you what you are doing wrong (are you sure you have a true widget object as your myWidget var?).
Look Robert, I modified this:
I suppose that this.widgetId make reference to widget that I'm working (MyWidget). All this are in MyWidget folder
onExecute : function (featureSet) {
WidgetManager.getInstance().triggerWidgetOpen(this.widgetId)
.then(function (myWidget) {
var arrVal= featureSet.fields.values();
myWidget.showVertexCount(arrVal);
});
I think that this function have to send arrVal variable to the showVertextCount function in Widget.js. Or that's wrong?
I did it the same like Demo widget, that interacts with Select widget. (maybe I'm wrong)
Rolando,
Is your widget opening?
yes Robert, when I click in query button, must print arrVal
but, this is the result:
Now, arrVal is a global variable and _theLastTry runs when I click query button (Widget.js)
Rolando,
Have you tried putting a console.log(arrVal); in your showVertexCount function?
Robert, I just did it, but it doesn't work.
Look, I want to do this (but with arrVal)
if you have any idea, It would be great.
Rolando,
So did the console print null for that console.log line?
Yes Robert, it prints null
in your onExecute function have you checked the arrVal with s console statement before it is passed to the widget?