mpryvkin / jquery-datatables-row-reordering

JQuery plugin that enables drag and drop row reordering in the tables enhanced with JQuery DataTables plugin.
https://www.gyrocode.com/articles/jquery-datatables-row-reordering/
6 stars 8 forks source link

Multiple tables on single page, only first table works #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. initialize two dataTables on single web page with rowReordering()
2. Go to web page

What is the expected output? What do you see instead?
1. Drag and drop rows on first table - works fine
2. Drag and drop rows on second table - quirky behavior, does not work

What version of the product are you using? On what operating system?
JQuery 1.7.2 or 1.7.3
JQery-UI-1.8.21.custom.css
JQery-UI-1.8.21.custom.min.js
jquery.dataTables.js    v1.9.1
Windows XP and Windows Server 2003

Please provide any additional information below.

Original issue reported on code.google.com by lgma...@fs.fed.us on 20 Jul 2012 at 8:00

Attachments:

GoogleCodeExporter commented 9 years ago
This functionality works but it is important that the first column of the 
datatable isn't the same id for the different tables.

So if you want to use the ordering on several tables, you have to introduce 
your data like this:

table1 = $("#table1").dataTable({
              "aaData": 
                 [
                            {
                            "DT_RowId": "table1_id_1",   <= very important
                "DT_RowClass": "table1Row", 
                            "column1": "value1",
                            "column2": "value2"
                            },
                            {
                            "DT_RowId": "table1_id_2",   <= very important
                "DT_RowClass": "table1Row", 
                            "column1": "value1",
                            "column2": "value2"
                            }
                 ]
}).rowReordering();

table2 = $("#table2").dataTable({
              "aaData": 
                 [
                            {
                            "DT_RowId": "table2_id_1",   <= very important
                "DT_RowClass": "table2Row", 
                            "column1": "value1",
                            "column2": "value2"
                            },
                            {
                            "DT_RowId": "table2_id_2",   <= very important
                "DT_RowClass": "table2Row", 
                            "column1": "value1",
                            "column2": "value2"
                            }
                 ]
}).rowReordering();

I hope that it will help you.

Original comment by volant.b...@gmail.com on 20 Sep 2012 at 4:20

GoogleCodeExporter commented 9 years ago

Original comment by joc...@gmail.com on 27 May 2013 at 9:29

GoogleCodeExporter commented 9 years ago
Hi,

Could you please try it with the latest version 1.1.0. It works on 
http://jquery-datatables-row-reordering.googlecode.com/svn/trunk/multipleTables.
html

Thanks,
Jovan

Original comment by joc...@gmail.com on 28 May 2013 at 8:21