Hide columns depending on checkbox state with Javascript
#states is a good JavaScript only approach to hiding simple markup, but sometimes we need to modify the render array itself

To add/remove form elements or complex render arrays based on feedback, you can do so by checking the value of $form_state['values']['my_fieldset']['my_checkbox'] in a condition around your table column logic. Also wrap the other_fieldset with a div defined in #prefix and #suffix that has that wrapper id.

if (isset($form_state['values']) &amp;&amp; $form_state['values']['my_fieldset']['my_checkbox']) {
  // Add slot1/slot2 columns here.
}


Then add an AJAX/AHAH to the checkbox element:

$form['my_fieldset']['my_checkbox'] = array(
    '#type' =&gt; 'checkbox',
    '#title' =&gt; t('my title'),
    '#default_value' =&gt; 1,
    '#disabled' =&gt; FALSE,
    '#ajax' =&gt; array(
      'callback' =&gt; 'my_module_form_ajax_callback',
      'wrapper' =&gt; 'other-fieldset-id-wrapper',
      'method' =&gt; 'replace',
      'effect' =&gt; 'slide',
    ),
);


Then implement a function to return the form element you want to replace. Note that you do not modify the form/form_state here and modifying the form will have no effect. However the value of the checkbox will be stored in form_state values when the form is re-rendered.

  function my_module_form_ajax_callback($form, $form_state) {
    return $form['other_fieldset'];
  }