inline edit plus submit/save button

inline edit plus submit/save button

MadMax76MadMax76 Posts: 149Questions: 33Answers: 1

in another discussion we build a inline-editor not submitting after each field.
(https://datatables.net/forums/discussion/68103/inline-edit-submit-only-when-leaving-row-instead-of-cell#latest)

we ended up with

$('#liste_positionen').on('click', 'tbody td:not(:first-child, :last-child)', function () {
               editor_pos.one( 'open', () => {
                            $('input', this).focus();
                        });
                editor_pos.inline( table.cells(this.parentNode, '*').nodes() );
                    } );

I noticed the users do not always unterstand, that they can/have to end with the enter-button. Therefore I added this

            editor_pos.inline(this, { submitTrigger: -1,
                submitHtml: '<i class="fa fa-save" style="font-size:24px;"/>'
            } );

For some reason, they do not like each other, the save-button vanishes if I click into another field, if I go there with the tab-key, the fields are not "open" for input.

How can I combine these features?

Thanks
Max

Answers

  • allanallan Posts: 63,602Questions: 1Answers: 10,486 Site admin

    Hi Max,

    When you say you added it - do you mean you had two different calls to inline()? It looks like you should use:

    $('#liste_positionen').on('click', 'tbody td:not(:first-child, :last-child)', function() {
        editor_pos.one('open', () => {
            $('input', this).focus();
        });
        editor_pos.inline(table.cells(this.parentNode, '*').nodes(), {
            submitTrigger: -1,
            submitHtml: '<i class="fa fa-save" style="font-size:24px;"/>'
        });
    });
    

    Allan

  • MadMax76MadMax76 Posts: 149Questions: 33Answers: 1

    thanks! Combined with this
    https://datatables.net/forums/discussion/63189/editor-select2-and-focus

    this does the trick!!

    But I have a most interesting phenomen: when calling the site via a ajax-call, this does not work (tab highlights the next field, but focus stays where it was) - when calling it via link or after refreshing the page, it does work. This is in a password-protectet site, I send you the login via PN.

    Thanks
    Max

  • MadMax76MadMax76 Posts: 149Questions: 33Answers: 1

    Hi Allan,

    did you have a chance to look at this behaviour?

    Thanks
    Max

Sign In or Register to comment.