How can i edit multiple rows together

How can i edit multiple rows together

Aryan1703Aryan1703 Posts: 77Questions: 20Answers: 1
edited April 5 in Editor

var commentEditor = new $.fn.dataTable.Editor({ ajax: "../../ajax/at/issueLog/issueLog.php", table: "#defectLogTable", fields: [ { label: 'Comment', name: 'comment' }, ], formOptions: { main: { scope: 'cell', onBackground: 'none', onBlur: 'none', onEsc: false, drawType: 'none' } } }); editor.on('onClose', function (e, json, data, action) { commentEditor .title('Please add a comment for the changes you have made.') .buttons('Save') .create(); return false; });

What i want is when i edit multiple rows together and press Update the comment editor should open automatically where same comment is added to all the rows that were selected.

Thanks

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    How have you got the route selection in the DataTables configured? As you'll see in this example multi role selection and editing is available by defiant in Editor.

    Allan

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    ... and do you want the comment to be applied automatically as part of the save, or do you want the Editor form to open with the pre-set comment in place.

    Colin

  • Aryan1703Aryan1703 Posts: 77Questions: 20Answers: 1

    No what i want is when i edit multiple row( which are editable) and press Update, another editor should open which is comment Editor and you can manually add a comment that goes in all the rows.

    The problem here is it should edit the row but it is creating it causing a issue.
    i..e The action is create instead of edit

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    I need to confirm my understanding here. You want to open another Editor, after you have multi-row edited the table, which would perform another edit on that same table and the same rows? Can you not just add the "Comments" field to the main Editor if that is the case?

    Allan

  • Aryan1703Aryan1703 Posts: 77Questions: 20Answers: 1

    I included the rows and got what i was looking for

                var rows = table.rows({
                    selected: true
                }).indexes();
                commentEditor
                    .title('Please add a comment for the changes you have made.')
                    .buttons('Save')
                    .edit(rows);
                return false;
    
    
Sign In or Register to comment.