Previous / next editing buttons with in table form controls

Previous / next editing buttons with in table form controls

jgcaudetjgcaudet Posts: 82Questions: 7Answers: 0
edited June 2016 in Editor

Hi Allan
I use in table form controls to edit/remove rows.
I want to implement https://editor.datatables.net/examples/api/backNext.
I use something like this, and it works :

$('#example').on('click', 'a.editor_edit', function (e) {
   pFilaTR = $(this).parents("tr");     
   ......
  {label: ">",
            fn: function (e) {
                // On submit, find the currently selected row and select the next one
                this.submit( function () {
                    var next = pFilaTR.next("tr");
                    pFilaTR = (next.length) ? next : pFilaTR.prevAll("tr").last();
                    pFilaTR_id = pFilaTR.attr('id');
                    oTable.row(pFilaTR).select();
                        $('#' + pFilaTR_id +' a.editor_edit').click();
                }, null, null, false );
            }
        } ;
  ....
}

but I have to problems
1.- only works in the page I see, it doesn,t go to the previous/next row pages
Do you have another solution ?

2.- I don´t want to submit any changes, so if I use :

{label: ">",
            fn: function (e) {
                this.close();
                var next = pFilaTR.next("tr");
                pFilaTR = (next.length) ? next : pFilaTR.prevAll("tr").last();
                pFilaTR_id = pFilaTR.attr('id');
                oTable.row(pFilaTR).select();
                $('#' + pFilaTR_id +' a.editor_edit').click();
            }
} ;

it is produced an annoying vertical displacement occurs up-down window
How can I avoid this without sending a submit ?
Can I have any problem If I don´t use this.close() ?
It will stay open instances of the editor ?

Thanks

Answers

  • Tom (DataTables)Tom (DataTables) Posts: 139Questions: 0Answers: 26

    1) Are you using server side processing? If so that is the problem as the next row/page doesn't exist on the client side, you would have to disable server side processing since the data needs to exist on the client side.

    2) There is currently no option for this, Editor doesn't provide a queueing mechanism, which I assume is what you want. At the moment each row needs to be submitted as it is edited for the data to be preserved.

    Thanks

    Tom

  • jgcaudetjgcaudet Posts: 82Questions: 7Answers: 0

    I don´t want to modify any data. I want move to the next/previous without saving anything. So I use "this.close()" and then edit the next/previous.
    My question is if I can edit the next/previous without sending a "this.close()" because it produced an annoying vertical displacement up-down editor window.

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    I'm afraid there is no option for what you are looking to do as Tom mentioned in 2). When you move on to edit a different row you must either submit the data to be saved, or discard the changes. There is no queuing mechanism to store the changes for later submission (that is an area I hope to look into in future).

    "this.close()" because it produced an annoying vertical displacement up-down editor window.

    Can you give us a link to a page that shows that please? I don't see that in the example you linked to.

    Allan

This discussion has been closed.