Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
350
igx-checkbox disabled state
posted

Hi everyone,

I am having trouble setting the disabled status of a checkbox.

I get the html element for the checkbox with a querySelector:

let myCheckbox: HtmlInputElement | null = document.querySelector("#idOfMyIgxCheckbox");

(I can't use a ViewChild at this point, because the checkbox is not displayed directly when creating the view / the component in which the checkbox is used)

There I have the possibility to set the disabled state of this checkbox:

myCheckbox.disabled = true;

But setting this property has no effect. After setting this proprty to true, the checkbox is still enabled and can be edited.

Could you please suggest a solution on how I can change the disabled state of a checkbox.


Thanks in advance and best regards

Michael

Parents
No Data
Reply
  • 60
    Offline posted

    Hello Michael,

     

    I’ve investigated your question regarding the disabled property of the checkbox element. I would recommend setting it within the html template “<igx-checkbox [disabled]="boolean">. I’ve prepared a small sample where with a button you can hide/show the checkbox and with a second button disable/enable it. The disabled state persists even if the checkbox is visible or not.

    Please take a look at them and let me know if I may be of any further assistance.

    Regards,
    Aleksandar Atanasov,
    Infragistics.

Children