Skip to content

Undocumented change in set_enabled(...) behavior #4217

Answered by falkoschindler
thetableman asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, I see. The "click" event is blocked by disabling the element, but the "change" event isn't. But I think the "change" event needs to always trigger, no matter how the value changes.

In your scenario you're disabling elements to avoid database updates being called multiple times. I don't fully understand how this works, but I don't think introducing yet another parameter like disable_on_change is the best way forward. Instead you can simply check the enabled state in your handler:

def select_change(e: events.ValueChangeEventArguments):
    if not e.sender.enabled:
        return
    ...

Or you introduce a dedicated flag in your user code instead of using the enabled attribute.

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@thetableman
Comment options

Comment options

You must be logged in to vote
1 reply
@thetableman
Comment options

Comment options

You must be logged in to vote
4 replies
@falkoschindler
Comment options

Answer selected by thetableman
@thetableman
Comment options

@falkoschindler
Comment options

@thetableman
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants