rowReorder - determine the row that was moved for further use on php-save

rowReorder - determine the row that was moved for further use on php-save

online student registration - Germanyonline student registration - Germany Posts: 5Questions: 3Answers: 0

Hello,

I have a table with a date field plus a position field that indicates the position of the row only in reference to the rows with the same date: several to-do-tasks per day. When, by reordering, a task-row is moved to another day, I need to update this row to have the new date. The $_POST that my php on the server receives, has the row_ids with their new positions. But I cannot determine, which one is the row that has been moved, to update the date to target row's date. How can this be achieved?

    "rowReorder": {
        dataSrc: 'position',
        selector: 'td.reorder',
        editor: editor
    },

Answers

  • allanallan Posts: 64,016Questions: 1Answers: 10,555 Site admin

    You could perhaps use pre-row-reorder - listen for that event and determine the node that was used to activate the order change and use that as part of the data to send to the server (initSubmit perhaps, or preSubmit).

    That said, without knowing the full data structure, I'm feeling a bit uncertain about this. You might be changing the position of multiple rows - can that cause the all to change data? I wonder if you need to spin over all rows and update their dates based on their new positions?

    Allan

  • online student registration - Germanyonline student registration - Germany Posts: 5Questions: 3Answers: 0

    Hello Alan

    Thank you for your answer. I have successfully used pre-row-reorder and then tried to do:

    editor.field('fieldname').val(modifiedValue)

    in initSubmit to add the information.

    However, there are two (or more) rows submitted and both/all are set to the same value, if I do it like that. Also, only the reorderField is submitted and I would have to smuggle data into that, which makes it pretty dirty. How can I add additional custom posted data in the case of an reorder submit?

    And yes, I will have to implement some extra logic on the server side.

    Martin

  • rf1234rf1234 Posts: 3,049Questions: 88Answers: 424
    edited 9:40AM

    "initSubmit" is cancellable; just return "false" if you don't want the Editor submission in your particular use case. Then make your own ajax call to do the database update.

    You might also need an "ajax.reload" afterwards. Just check the docs on that one, too.

Sign In or Register to comment.