how to submit one cell on inline edit

how to submit one cell on inline edit

seth9009seth9009 Posts: 48Questions: 9Answers: 2

So i'm trying to implement this example to allow inline checkboxes https://editor.datatables.net/examples/api/checkbox.html but on checkbox click it sends the entire row, while i want to send only the checkbox name and value, and i can't seem to make it work, this is my code

    dtable.on('change', 'input.inline-checkbox', function(e, datatable, cell) {

      var cell = $(this).closest('td');
      var cellNode = dtable.cell(cell).node();

      editor
        .edit(cellNode, false)
        .set($(this).attr('name'), $(this).prop('checked')?1:0)
        .submit();

    });

This question has an accepted answers - jump to answer

Answers

  • IT MarcariaIT Marcaria Posts: 13Questions: 5Answers: 1
    Answer ✓

    Hi,

    I made it work by adding the option submit: changed.

    See below using your configuration, I assume your code works.

    editor
             .edit(cellNode, false, {
                    submit: 'changed'
             })
             .set($(this).attr('name'), $(this).prop('checked') ? 1 : 0)
             .submit();
    

    This will be the code for the example on api/checkbox.html

    $('#example').on( 'change', 'input.editor-active', function () {
            editor
                .edit( $(this).closest('tr'), false, {
                        submit: 'changed'
                    } )
                .set( 'active', $(this).prop( 'checked' ) ? 1 : 0 )
                .submit();
        } );
    

    Best regards,
    Sergio González

This discussion has been closed.