Datatables: combining Row Reorder and Form Inputs

Datatables: combining Row Reorder and Form Inputs

BoltBaitBoltBait Posts: 19Questions: 4Answers: 0

I'm trying to combine both

Row Reorder
https://datatables.net/extensions/rowreorder/examples/initialisation/events.html

and

Form inputs
https://www.datatables.net/examples/api/form.html

I want to be able to have the drag-and-drop row ordering and editable data.

Here's the problem I can't figure out: every time I drag-and-drop reorder a row, it reverts the data back to the initial state instead of what the user typed into the text fields. I want the data entry fields to stay the same!

Anyone have a solution for that?

    $(document).ready(function () {
    var table = $('#mytable').DataTable({
        rowReorder: true,
        lengthMenu: [[-1, 25, 100, 200], ["All", 25, 100, 200]],
        columnDefs: [
            { orderable: true, className: 'reorder', targets: 0 },
            { orderable: false, targets: '_all' }
        ],
    });

The HTML is standard table, tr, td, input type=text type stuff.

I have also asked this question on StackOverflow, here: http://stackoverflow.com/questions/33404304/datatables-combining-row-reorder-and-form-inputs

Thanks!

This question has an accepted answers - jump to answer

Answers

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75
    edited October 2015

    This is actually a known bug I reported a while ago -> here

    @allan is working on getting a fix for this.

    I haven't found any work around for it :-(

    I tried to see if invalidating the rows after updating the values, then reordering would update the cached data that the RowReorder sees, but it didnt

  • BoltBaitBoltBait Posts: 19Questions: 4Answers: 0

    Wow. That's really disappointing.

    Datatables looks very promising, but I guess I'll have to search for a different solution.

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    Yeahhh... It is kind of a big one, totally rules out using the extension on form related tables, or DataTables entirely if reordering is a must, which is the position im in with one of my DT instances. I holding back a feature release until i can get it fixed

    but im pretty sure itll be resolved in the next few updates.

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    Its on my list of things to do! Hoping to get to it in the next few days.

    Allan

  • BoltBaitBoltBait Posts: 19Questions: 4Answers: 0

    allan, that is fantastic news!

    I'm looking forward to the next update. :)

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75
    edited October 2015

    Next few days? That would be AWESOME! Ill send you a box of chocolates, maybe some flowers too.

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    Assuming all goes well. This afternoon has not been a good afternoon...

    I'll post back here when its done.

    Allan

  • BoltBaitBoltBait Posts: 19Questions: 4Answers: 0

    I see that this has been fixed in the nightly build.

    That is fantastic news.

    I will use the nightly build until the official build comes out. When will that be?

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Answer ✓

    Planning to do the release at the end of this week - although that is dependent upon a number of other things, so we'll see how it goes!

    Allan

  • BoltBaitBoltBait Posts: 19Questions: 4Answers: 0

    Thanks!

    My only wish now is that the DocX guys had the same level of support...
    https://docx.codeplex.com/discussions/646848

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75
    edited November 2015

    Told ya man, @allan has great support

    And sorry about the DocX issue. I supported Microsoft products for a couple years, while I was learning Linux, and I dont ever plan on supporting anything Microsoft related again, ever, ill jump off a bridge before I do that! I think the only thing worse than things like ASP.NET would be Coldfusion.. lol

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    In fairness, poor old jLinux has been waiting on this fix for almost 2 months... :-)

    Allan

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    :-D Waiting patiently too! lol.

    But its absolutely worth the wait! Thanks again

  • drewk538drewk538 Posts: 1Questions: 0Answers: 0

    Bump. .... Is this one done yet? Thanks

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    Yes - was done just over a week ago. RowReorder 1.1.0 is available now.

    Allan

This discussion has been closed.