Full Row/ Inline Edit Example

Full Row/ Inline Edit Example

c-myers1c-myers1 Posts: 43Questions: 16Answers: 0

Looking at the example at the bottom here, I can clearly see the inline part and to my understanding, the code

$('#approve').on( 'click', function () {
    editor
        .edit( false )
        .val( 'approved', 1 )
        .submit();
} );

works along with this to toggle the value of approved in that row to 1 and then submit the entire tables data.

But your intro partly reads "In this example we create a single Editor instance, which is used for both full row editing of a DataTable and inline editing."

Where is the "full row editing" part here? Is it implicit by clicking the "Edit" button?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin
    Answer ✓

    There is nothing there to tell Editor what it should actually edit. The edit() method expects some kind of identifier as the first parameter parameter passed into it (that's how you tell it what row to edit). The example of the docs page you linked to there is wrong I'm afraid - I will correct that forthwith!

    It should be using:

    .edit( table.rows( {selected: true } ).indexes(), false )
    

    i.e. get the row indexes for the selected rows, edit them, set their approved flag and submit.

    Where is the "full row editing" part here? Is it implicit by clicking the "Edit" button?

    Correct. edit() is full row editing, while inline() is inline editing.

    Allan

  • c-myers1c-myers1 Posts: 43Questions: 16Answers: 0

    But you can edit a full row “inline” so what’s the difference? Inline doesn’t necessarily mean single cell editing.

  • c-myers1c-myers1 Posts: 43Questions: 16Answers: 0

    Never mind: inline means single cell inline editing from DT perspective.

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Yes - inline just means the display of a single editing field in the table - you can use the API to edit the whole row.

    I didn't really have a better term other than "full row" to explain the main editing window!

    Allan

This discussion has been closed.