I am exploring Oracle APEX JS APIs and identified this peculiar behaviour.
When I tried overidding the inbuilt model.setValue function like this
apex.region("emp").widget().interactiveGrid("getViews", "grid").model.setValue = function(){
alert("model set value called");
}
console.log(apex.region("emp").widget().interactiveGrid("getViews", "grid").model.setValue);
And I get the output as
function(){
alert("model set value called");
}
the function got successfully overridden and when I call model.setValue on the grid it shows the alert message.
But when I did the same thing on setValue function of apex.item
apex.item("P3_NEW") = function(){
alert("model set value called");
}
console.log(apex.item("P3_NEW").setValue)
the output is
ƒ (e,t,a){u.call(this,e,t,a),this.afterModify&&this.afterModify(),a||this.element.trigger("change")}
the JavaScript function is not overriden and apex.item("P3_NEW").setValue() didnt give the alert.
What design differences do these two APIs have that make model.setValue mutable and apex.item(...).setValue Immutable?
I believe I am missing a JS concept and finding answer to this will lead me to it. Any guidance is appreciated.
Thankyou