How to create a drag & drop sorting interface programmatically?
Here is a drupal_add_tabledrag function using which you can add draggable functionality programmatically.


  Assists in adding the tableDrag JavaScript behavior to a themed table.
  
  Draggable tables should be used wherever an outline or list of
  sortable items needs to be arranged by an end-user. Draggable tables
  are very flexible and can manipulate the value of form elements placed
  within individual columns.


See this blog for example. You may need to imprement theme function.

$element = $vars['element'];
drupal_add_tabledrag('sample_table', 'order', 'sibling', 'item-row-weight');

$header = array(
  'label' =&gt; t('Attribute'), 
  'checkbox' =&gt; t('Enabled/disabled'),
  'weight' =&gt; t('Weight'),
);