Inline radio doesn't emit data

Inline radio doesn't emit data

jamailunjamailun Posts: 2Questions: 1Answers: 0

Hello,

I'm currently using Editor, and I have a table with inline editing. My backend is in Flask, and it's not the source of the problem.
When I try to edit a text or textarea column, it works properly. The ajax.edit() method is called is the JS (see below). But, when I click on a radio, nothing is emitted. The options parameter is well parametred (as an array of the values), so I don't see the problem. Is it a bug of the framework ? Or I didn't see something (it's most likely the case) ?
Note that the radio, has options, only have two parameters : true & false.

The relevant part of the JS :

// create editor
var editor = new $.fn.dataTable.Editor( {
    ajax: {
        edit: {
            url: `/backend/path/to/action`,
            type: 'POST',
            data: function (args) {
                // when I edit a text/textarea field, the args IS printed in the console.
                //But, which radio field, it's not the case, and that's my problem.
                console.log(args); 
                return { "args": JSON.stringify(args) };
            }
        }
    },
    table: some_table_reference,
    idSrc: 'id'
});
// add fields in a loop...
// and then add something like this :
editor.add({
    label: "some title",
    name: "somePropertyName",
    attr: {'class':'form-control'},
    type: "radio",
    options: [true, false],
    def: false
});

I don't have any error. My radios buttons can appear and stuff, but to click on them don't do anything.
I don't find anything else is the Manual ☹️

I can answer your questions, thanks for your time.

jamailun.

Answers

  • jamailunjamailun Posts: 2Questions: 1Answers: 0

    Up.
    I can confirm the problem with editor.inline( /* ref */ );.
    If I use bubble instead of inline, everything works. So the framework could have an issue with radio & inline ?

  • allanallan Posts: 54,181Questions: 1Answers: 8,456 Site admin

    Apologies for the delay in getting back to you here. I'm not seeing anything obvious in the above code that would cause a problem. Also I've just tried inline editing in this example - you can do so by running the following in your browser's console:

        $('#example').on( 'click', 'tbody td', function (e) {
            editor.inline( this, {
                onBlur: 'submit'
            } );
        } );
    

    It seems to work as expected.

    Can you give me a link to your page?

    Thanks,
    Allan

Sign In or Register to comment.