Custom Multi-Edit Button

Custom Multi-Edit Button

TooManyTablesTooManyTables Posts: 23Questions: 7Answers: 1
edited December 2017 in Editor

I feel kind of silly for asking, since it seems like a simple thing to do, but I want to make a custom edit button which can handle multiple selections. I've got an existing custom edit button that sits in each row and works just fine, and I figured I could adapt it, but then my brain decided to go away and I'm having a complete blank. Existing button:

$('.btn-edit').on('click', function(){
            e.preventDefault();
 
            area_loan_editor.edit( $(this).closest('tr'), {
                title: '<h3>Edit loan</h3>',
                buttons: {
                    label: 'Save',
                    className: 'btn-primary',
                    fn: function () {
                        this.submit();
                    }
                }
            });
        });

What I thought would work, but doesn't:

$('#editSelectedButton').on('click', function(){
            e.preventDefault();
 
            area_loan_editor.edit(area_loan_table.rows('.selected'), {
                title: '<h3>Edit loan</h3>',
                buttons: {
                    label: 'Save',
                    className: 'btn-primary',
                    fn: function () {
                        this.submit();
                    }
                }
            });
        });

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Answer ✓

    Try either:

    area_loan_table.rows('.selected').indexes()
    

    or

    '.selected'
    

    for the first parameter passed into edit().

    Allan

  • TooManyTablesTooManyTables Posts: 23Questions: 7Answers: 1

    When in doubt, RTFM. :blush:

    Cheers allan!

This discussion has been closed.