Datatables: combining Row Reorder and Form Inputs
Datatables: combining Row Reorder and Form Inputs
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
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
Wow. That's really disappointing.
Datatables looks very promising, but I guess I'll have to search for a different solution.
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.
Its on my list of things to do! Hoping to get to it in the next few days.
Allan
allan, that is fantastic news!
I'm looking forward to the next update. :)
Next few days? That would be AWESOME! Ill send you a box of chocolates, maybe some flowers too.
Assuming all goes well. This afternoon has not been a good afternoon...
I'll post back here when its done.
Allan
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?
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
Thanks!
My only wish now is that the DocX guys had the same level of support...
https://docx.codeplex.com/discussions/646848
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
In fairness, poor old jLinux has been waiting on this fix for almost 2 months... :-)
Allan
:-D Waiting patiently too! lol.
But its absolutely worth the wait! Thanks again
Bump. .... Is this one done yet? Thanks
Yes - was done just over a week ago. RowReorder 1.1.0 is available now.
Allan