Inline Editor and type = 'select' fields

Inline Editor and type = 'select' fields

jflaplantejflaplante Posts: 3Questions: 1Answers: 0

I'm trying to use a super basic select field with two values 'A' and 'D' with the inline editor.

{
                label: "Statut",
                name: "statut",
                type:  "select",
                options: [
                    { label: "A", value: "A" },
                    { label: "D", value: "D" }
                ]
            }

I would like that either (or both) selecting a value AND/OR pressing the return key trigger a submit event. I'm not fussy!

I've searched and the closest that I have come to a solution was with this post:

https://datatables.net/forums/discussion/22754/im-looking-for-an-example-of-using-an-inline-select

Specifically Allan's reply stating that there's no way to distinguish between the expected return key behaviors. That was a 2014 post and I was wondering if in 2016 there's a solution to achieve that seemingly simple goal?

I've found other more recent posts that I've found are not exactly related to this situation.

I've tried the 'onReturn' and 'submitOnblur' options with no success. The ideal option would be sound like 'onSelect' = 'submit' or submitOnselect = 'true'

    // Activate an inline edit for ENTETE on click of a table cell 
    $('#entete').on( 'click', 'tbody td:not(:first-child)', function (e) {
    entEditor.inline( this, {
        submit: 'all'//, //Submit all information even if not changed
        //onReturn: 'submit',
        //submitOnBlur: true
    } );
} );

BTW, everything works fine in the bubble editor.

Thanks in advance.

This question has an accepted answers - jump to answer

Answers

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

    Hi,

    Currently there isn't a better way to do this I'm afraid. However, the plan is to address this with 1.6 which will rework how Editor handles the return key, passing the responsibility of doing so to each field type plug-in. I think (hope!) that this might allow me to write some code specific to select elements that will allow this to work as expected. To be honest, I don't yet know if it will, but I have hopes that it will!

    Allan

  • jflaplantejflaplante Posts: 3Questions: 1Answers: 0

    Thanks for your reply Allan,

    Leaving aside the return key, can the action of selecting a value using the 'select' control by itself be used as a trigger for a submit?

    I'm using the selectize plug-in for another field and it does work in both forms of editors. I can always fall back on the selectize method but since this particular 'select' has only two possible choices, it seemed overkill.

    Thanks.

    JF.

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

    can the action of selecting a value using the 'select' control by itself be used as a trigger for a submit?

    Sure - use field().input() to get the select element and then just use a jQuery change event handler that will call submit().

    Allan

  • jflaplantejflaplante Posts: 3Questions: 1Answers: 0

    Thank you for your time Allan.

This discussion has been closed.