3

I'm using lightning:checkboxGroup and I'm trying to set the state one of the individual checkboxes as indeterminate. I tried the following JS:

component.find("my-chbxgroup").getElement().querySelector("input[value=val1]").indeterminate = true;

But Locker Service won't let me access the DOM of lightning:checkboxGroup.

Is there any way I could accomplish it without disabling Locker Service?

1
  • A minimal set of code to replicate the issue would be helpful.
    – Raul
    Commented May 18, 2018 at 9:17

1 Answer 1

3

If you are using <lightning:input type="checkbox" ... /> then I think you are stuck for now as that does not expose an attribute that can set the underlying DOM indeterminate property that then drives the SLDS styling.

You will have to experiment. One solution might be to create your own checkbox Lightning Component that does expose an indeterminate property. Be sure to apply the SLDS classes. (This would be a bit cleaner than using raw HTML.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .