about rowOrder drag numbers

about rowOrder drag numbers

icehotaicehota Posts: 3Questions: 3Answers: 0

Hei, I'm using rowOrder now.
Got two problems.
When I drag a row, no mater where I drag it to, it only move one row
so if I want to drag the first row to the fourth row, I have to do it three time.
Is there any way to change this setting.

And it seems that the order on the head will effect the rowReorder,I'm readding the documents now.

Answers

  • SamuelNZSamuelNZ Posts: 62Questions: 5Answers: 2

    Can you post a JSFiddle of what you are working on, I'm interested in having a play with rowOrder.

    I think you need to do something like this

    $('#example').DataTable( {
        rowReorder: {
            snapX: -5
        }
    } );
    
  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    Yes, if you could post a link to an example please - there should be no need to more the row just one at a time. In the examples on this site you should be able to see that rows can be moved multiple places at a time.

    The rowReorder.snapX option will fix the horizontal location of the "ghost" row while it is being dragged, relative to the left hand side of the DataTable.

    Allan

  • SamuelNZSamuelNZ Posts: 62Questions: 5Answers: 2
    edited November 2015

    The example you linked isn't moving at all on Chromodo. (Comodo's version of chromium)

    I too have the feeling it was ghosting hence the snapX suggestion, But without an example its impossible to figure it out, It could be something as simple as initializing in the wrong order..

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    Agreed - we can't really help without a test case.

    Regarding my link - are you saying that the row reordering doesn't work at all, or that the table doesn't scroll while your are dragging? For the latter - deploying the example with the scrolling enabled was a mistake (I've removed it now) that is a missing feature, but it should be able to drag no problem.

    Allan

  • Paulie222Paulie222 Posts: 2Questions: 0Answers: 0

    Yes, I am having the same problem. When using rowReorder I can only move the row up or down one at a time no matter which order I put it into. Also the underlying tr takes it's original place.

  • Paulie222Paulie222 Posts: 2Questions: 0Answers: 0
  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    As noted above, we'd need a link to a test page showing the issue to be able to offer any help. Use JSFiddle or http://live.datatables.net if you can't host a test case yourself.

    Allan

  • deltrotterdeltrotter Posts: 2Questions: 1Answers: 0

    Hmmm, having exactly the same problem. I can only move a draggable row one row at a time. Even then, once dragged and dropped the ordering is not as it should be. Here is my code:

        <script type="text/javascript">
        $(document).ready(function() {
            $('#folders').dataTable( {
                responsive: {
                    details: {
                        display: $.fn.dataTable.Responsive.display.childRowImmediate,
                        type: ''
                    }
                },
                "lengthChange": false,
                "searching": false,
                "pageLength": 10, // number of records per page default
                "pagingType": 'bootstrap_extended', // pagination type
                "order": [], // allow column ordering without forcing initial order
                "rowReorder": true,
                columnDefs: [
                    { responsivePriority: 1, targets: 0 }, // make folder first in priority
                    { responsivePriority: 2, targets: 1 }, // make tools second in priority
                    { width: '100%', targets: 0 }, // make folder width 100%
                    { orderable: true, className: 'reorder', targets: 0 }, // make folder draggable
                    { orderable: false, targets: -1 } // do not allow tools to be orderable
                ],              
                "language": {
                    "aria": {
                        "sortAscending": ": activate to sort column ascending",
                        "sortDescending": ": activate to sort column descending"
                    },
                    "emptyTable": "No Folders found",
                    "info": "Showing _START_ to _END_ of _TOTAL_ Folders",
                    "infoEmpty": "No Folders found",
                    "infoFiltered": "(filtered from _MAX_ total Folders)",
                    "lengthMenu": "_MENU_ Folders",
                    "search": "Search:",
                    "zeroRecords": "No matching Folders found"
                },
            } );
        });
        </script>
    

    I have four table rows: 1, 2, 3, 4. If I try to move 4 to 1 the ordering goes: 2, 3, 4, 1.

    Any suggestions for where I am going wrong?

    TIA

    Del

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    Hi Del,

    Can you link to a page showing the issue please?

    Allan

This discussion has been closed.