How do I check by default a checkbox from a checkboxes control after an AJAX call
Thanks @IvanJaros, i have read it and i think i'm doing everything fine but i can't understand why is not working.

I have modify selectAjaxCallback to solve this problem:



public function selectAjaxCallback(array &$form, FormStateInterface $form_state) {
      $select = $form_state->getValue('select');

      foreach ($this->values['checkboxes_df'][$select] as $key => $value) {
        $form['container']['checkboxes'][$key]['#checked'] = $value;
      }
      return $form['container'];
    }



This code works, but i'm not sure if it's the right way to solve this problem.

Thanks.