Detect manually vs programmatic change in checkbox state ExtJS 4.1

728 views Asked by At

I'm using the checkbox component on an ExtJS 4.1 application. I put an event on the change event and do certain logic if the checkbox is checked or unchecked. The problem I have is that, the change event fires automatically on page load event if the user has not checked the checkbox manually.

Does anybody know how I can detect if the checkbox value (checked or unchecked) has been change by the user or how to prevent the change event from firing automatically on page load?

Thanks in advance for any help

1

There are 1 answers

0
Akin Okegbile On
  1. you can use the dirtychange event

  2. You can also check the checkbox.isDirty() parameter by

//function called on change event
onchange: function() {
    if (checkBox.isDirty() {
        //do something(option 1)
      } else {
        //do nothing(option 2)
      }

    }