I have this line of code that is giving me an error:
var source = event.getSource().getDataProviderID(); //Warning: The function getDataProviderID() is undefined in this script
The example code for getSource() makes it look like this is acceptable:
JSEvent.getSource(): Object
returns the source component/element of the event.
If it has a name the getElementName() is the name of this component.
var sourceDataProvider = event.getSource().getDataProviderID();
Am I missing something? When I try auto-complete after getSource() nothing comes up. Do I need to declare something?
gldni:
I have this line of code that is giving me an error:
var source = event.getSource().getDataProviderID(); //Warning: The function getDataProviderID() is undefined in this script
The example code for getSource() makes it look like this is acceptable:
JSEvent.getSource(): Object
returns the source component/element of the event.
If it has a name the getElementName() is the name of this component.
var sourceDataProvider = event.getSource().getDataProviderID();
Am I missing something? When I try auto-complete after getSource() nothing comes up. Do I need to declare something?
Thanks!
Please open a case in our support system about this (http://www.servoy.com/s) , event.getSource() returns an Object type, this is why no autocompletion is available. However this is just a warning, you can call that method just fine (if the source is indeed an element).
No, the problem is not missing auto-complete, but incorrect sample code, without type checking and “casting” through JSDoc.
.getSource() correctly returns “Object” as type, because the source of the event can be anything: RuntimeForm, RuntimeRadio a bean instance etc. The lowest common denominator for all these types is Object.
I have already created the case internally to get the sample code updated.