How to use drupal_add_tabledrag() with paging feature? I have set up a table to reorganize content based on custom weight field. Everything works well without pager.

But if I add a pager to the form, only the items displayed will be reorganized - causing conflicts with items in other pages. Why drupal_add_tabledrag doesn't consider only the weight values that are in the current page. This would avoid any item in current page to take the same value as an item in another page.

The Taxonomy Core module do it perfectly. For example in the form where you can reorganize terms, there is a pager (admin/structure/taxonomy/[vocabulary]):



In Taxonomy form, when there are several pages, the last item of a page will appear in in first in next page (so user can drag &amp; drop either against next items or/and previous items)

How can I do the same in a custom form? 

/**** EDIT ****/

Due to @Aneek Mukhopadhyay answer, I updated my post. 

Actually the issue is not related with pager, but drupal_add_tabledrag(). The pager is working well.

The drag &amp; drop feature too. The problem is that when reorganizing content in a page, some items will take a weight value already used by another item (in another page).

For example here is the first page of my form (before dragging any item):



And the second page:



If I move the item "Test 11" for example, new weight value for the item "Test 2" will be 2:



And the weight value 2 is already used by item Test 1 (in second page)

To achieve that I used drupal_add_tabledrag() this way:

drupal_add_tabledrag($table_id, 'order', 'sibling', 'example-item-weight');


I tried several options with drupal_add_tabledrag() but didn't find any other way to make it working without issues.

I also checked the taxonomy module but cannot figure out how they work with drupal_add_tabledrag().
This can be done. If taxonomy module does it then its doable isn't it? So to do that you have to mainly follow 2 functions. 


function taxonomy_overview_terms(..) in line # 249 @ /modules/taxonomy/taxonomy.admin.inc
function theme_taxonomy_overview_terms(..) in line 548 @ /modules/taxonomy/taxonomy.admin.inc.


The first function is the form that generates the list of items present in the term listing page. (The screenshot you attached)
The second function is the hook_theme implementation of the prior function and adds the table drag functionality to the page. If you look closely, the form has navigational steps added in it and then in the theme function they are made available for JavaScript to handle the back and forth navigation you mentioned. These are $form['#back_step'] &amp; $form['#forward_step']. Those are converted to backStep &amp; forwardStep and added to Drupal's JavaScript settings. So also you have to look at the taxonomy.js in where these are called and handled.