RowReorder example not clear to me if table.on('row-reorder') is required.

RowReorder example not clear to me if table.on('row-reorder') is required.

hvhoekhvhoek Posts: 5Questions: 1Answers: 0

Description of problem:
It is not clear to me if in the Editor RowReorder example, it is required to use table.on('row-reorder'...)?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794

    Are you referring to this example?

    I don't see the row-reorder event used in that example. Please tell us which example you are looking at. And why you are asking about the need for row-reorder.

    Kevin

  • hvhoekhvhoek Posts: 5Questions: 1Answers: 0

    Sorry for the unclear question. In my project the ajax calls are not generated when the rows are exchanged.

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    I would guess that you haven't used rowReorder.editor in that case, but we'd really need a test case or at least sight of the code, to be able to say for certain.

    Allan

  • hvhoekhvhoek Posts: 5Questions: 1Answers: 0

    Allen, I do have rowReorder.editor options filled in.

    Ok. Other attemt to clarify my misunderstanding. I don't blame you by the way.

    In the editor example, I can't see the code which I need to have to send the ajax requests for the update of the database. Or is it fully automatic?
    At least, not my case.
    I use now

    table.on('row-reorder', function (e, diff, edit) {
                  let result = 'Reorder started on row: ' + edit.triggerRow.data()[1] + '<br>';
    ...
    

    to intercept the information which I can sent to the backend.

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794

    Its automatic if you have this:

            rowReorder: {
                dataSrc: 'readingOrder',
                editor:  editor
            },
    

    Click on the Ajax Data tab and perform a row reorder. You will see the editor send the edit request with the ID's to change. And you will see the response from the server.

    Kevin

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    Answer ✓

    In this example, line 40 of the code block below the table you will see where I assign the Editor instance to rowReorder.editor. Editor has its own event handlers for that.

    If you aren't using Editor, then yes, you would need your own event handler for row-reorder.

    Allan

Sign In or Register to comment.