In an edit page, we have fields that can be changed by the user or calculated by the page Javascript code, depending on specific circunstamces.
In this case we need to inhibit the attribute dependency method call, to make sure it is not called when the field is calculated by the page code, and not by the user.
Is it possible ?
Regards,
Like
Hi Ricardo,
Everything is simple - these specific circumstances should be included into the logic of custom method calls inside the JavaScript code. So the logic itself should be redesigned.
Best regards,
Oscar
Oscar Dylan,
Ok, but what I am looking for is a way of disabling the handler method activation in the attribute dependency, so that when the field is updated by the code the handler method will not be triggered... The Javascript code would first disable the dependency method call, update the field, and then enable the dependency control again.
Ricardo Bigio,
One way to accomplish that is to add a property or attribute to the code where you can set a flag that the field is being updated via code, then in the event handler, check this flag to see if you should exit or continue The flag would only get set by code, so the user entering a value the flag won't be set and the event handler will trigger normally. Something like this:
suppressEvent: false, funcThatSetsDependentColumn: function() { this.suppressEvent = true; // set flag to suppress the event this.set("UsrDependentColumn", value); // set the column that will trigger the event }, dependentColChangeHandler: function() { // check if flag is set to suppress the event if (this.suppressEvent) { this.suppressEvent = false; // unset the flag and exit return; } // do other stuff in the event handler here }
Hope this helps,
Ryan