Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Just finished adding this functionality to my module</p> <p><a href="https://github.com/player259/ajax_table" rel="nofollow">https://github.com/player259/ajax_table</a></p> <p>There is no help, demo is outdated, but I'm working on it from time to time</p> <p>Sections support was achieved by overriding tabledrag.js functions</p> <p>Use this snippet to insert table</p> <pre><code>$form['map'] = array( '#type' =&gt; 'ajax_table', '#header' =&gt; array(t('Element'), t('Settings'), t('Weight')), 'rows' =&gt; array(), '#draggable' =&gt; array( // drupal_add_tabledrag will be called in theme layer // NULL first arg to apply to this table array(NULL, 'match', 'parent', 'perfect-form-parent', 'perfect-form-parent', 'perfect-form-index'), array(NULL, 'depth', 'group', 'perfect-form-depth', NULL, NULL, FALSE), array(NULL, 'order', 'sibling', 'perfect-form-weight'), ), '#draggable_groups' =&gt; array(), ); foreach ($map as $i =&gt; $element) { // ... some logic $form['map']['rows'][$i] = array( 'data' =&gt; array( 'element' =&gt; array(), 'settings' =&gt; array(), 'tabledrag' =&gt; array( 'index' =&gt; array( '#type' =&gt; 'hidden', '#value' =&gt; $element['data']['tabledrag']['index'], '#attributes' =&gt; array('class' =&gt; array('perfect-form-index')), ), 'parent' =&gt; array( '#type' =&gt; 'hidden', '#default_value' =&gt; $element['data']['tabledrag']['parent'], '#attributes' =&gt; array('class' =&gt; array('perfect-form-parent')), ), 'depth' =&gt; array( '#type' =&gt; 'hidden', '#default_value' =&gt; $element['data']['tabledrag']['depth'], '#attributes' =&gt; array('class' =&gt; array('perfect-form-depth')), ), 'weight' =&gt; array( '#type' =&gt; 'weight', '#delta' =&gt; $max_weight, '#default_value' =&gt; $weight, '#attributes' =&gt; array('class' =&gt; array('perfect-form-weight')), ), ), ), '#attributes' =&gt; array('class' =&gt; array($row_class_current, $row_class_child)), ); // This means that row with $row_class_child class could have as parent // only row with $row_class_parent class // NULL means root - there are no parents $form['map']['#draggable_groups'][$row_class_child] = $depth ? $row_class_parent : NULL; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload