rowReorder not work when draw row

rowReorder not work when draw row

foxer2010foxer2010 Posts: 2Questions: 1Answers: 0

Hello,
When i try To reorder row that i was created only first td reordered
I hope I can get some help here?

        var table = $('#example').DataTable({
            dom: '<"wrapper"t>',
            ordering:false,
            rowReorder: true,
            "iDisplayLength":50,
            columnDefs: [
                { orderable: true, className: 'reorder', targets: 0 },
                { orderable: false, targets: '_all' }
            ],
            "initComplete": function(oSettings) {
            $(this).on('click', "button.row-remove", function(e) {
              table.row($(this).closest('tr')).remove().draw();
            });
          }
        });
         var i = 0;
         $('a#add_row').click(function () {
             table.row.add([
                 '<span class="icon-drag"><span class="hide-id-drop">'+i+'</span></span>',
                 '<input name="company_name' + i + '" autocomplete="organiztion" type="text placeholder="organiztion name" class="form-control"/>',
                 '<button class="btn btn-danger glyphicon glyphicon-remove row-remove"></button>'
             ]).draw(false);
             i++;
         });

Answers

  • foxer2010foxer2010 Posts: 2Questions: 1Answers: 0
    edited March 2018

    i know where is problem
    i should enable ordering in table

    ordering:true,
    

    close please

This discussion has been closed.