Peacefull Peacefull - 4 months ago 33
jQuery Question

DataTables add data in row dynamically after validate button

In my project I'm trying to add label (ex:

) in the row at column Validate using DataTables but i can't manage it.

When i click on Open a new modal appear and then when i click on the content button HVV i would like to add a label in the column Validate (see pictures). How i can do that please ?

JSFiddle demo :

enter image description here
enter image description here

  1. Remove data: null for last column, add defaultContent: ''.
  2. Pass row Id to modal as data property data-row-id="' + rowIdx + '".
  3. Upon closing the modal, update the required column:

    var rowIdx = $('row-id');
        .cell({ row: rowIdx, column: 3})
        .data('<div class="label label-success">Valid</div>')

I don't understand the logic with OK/NOK states but you should get an idea and adjust the code accordingly.

See updated jsFiddle for code and demonstration.