jQuery UI Widgets Forums Angular JqxButton disabled state

This topic contains 4 replies, has 3 voices, and was last updated by  mikko 6 years, 9 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • JqxButton disabled state #96427

    adribea
    Participant

    Hi,

    In JqxButtonComponent, when [disabled]=”true” the click event (onClick)=”func()” also occurs, as i can do to make sure this event does not start when disabled so my func() is not called.

    Thank You

    JqxButton disabled state #96444

    Peter Stoev
    Keymaster

    Hi adribea,

    Within your click handler, you may add IF statement for the disabled state. If it is disabled, put return;

    Best Regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/

    JqxButton disabled state #96539

    adribea
    Participant

    Thanks, Peter, I’ve seen that this behavior only happens when using ImgSrc in the button, while in the normal button if it is disabled does not trigger the event. then use buttons with html content that work very well.

    Best Regards,
    Adriano Grandi

    JqxButton disabled state #96540

    Peter Stoev
    Keymaster

    Hi adribea,

    With image, the button does not have internal Button tag. It is a DIV tag. And it raises click events, because the DIV tag has no disabled state built-in. So the solution is within the click handler to add an IF check for the button’s state.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/

    JqxButton disabled state #99899

    mikko
    Participant

    In the below code disable=true doesn’t prevent click event, i.e. alert is run.
    $(‘#jqxButton’).jqxButton({
    theme: ‘energyblue’,
    width: ’90’, height: ’25’,
    textPosition:’center’
    });
    $(‘#jqxButton’).on(‘click’, function () {
    alert(‘You clicked me!’)
    });
    $(‘#jqxButton’).jqxButton({disabled: true });

    However, code without textPosition:’center’ works:
    $(‘#jqxButton’).jqxButton({
    theme: ‘energyblue’,
    width: ’90’, height: ’25’
    });
    $(‘#jqxButton’).on(‘click’, function () {
    alert(‘You clicked me!’)
    });
    $(‘#jqxButton’).jqxButton({disabled: true });

    It is very frustrating that you have not documented this “feature” on disabled property in jqxButton’s API.
    In fact, the disable property is not working correctly when textPosition is used.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.