Add Attribute Name Array In Cell Render ?

Add Attribute Name Array In Cell Render ?

AddisonAddison Posts: 13Questions: 4Answers: 0
edited April 2019 in Free community support

How can I add <input> array name in datatables. (child[0],child[1],child[2],child[3],etc)

$(document).ready(function() {

   t = $('#dataTables-poNo').DataTable({
      "pageLength": 3,
      "lengthMenu": [ 3, 5 ],
      "info": false,
      "bLengthChange": false,
      columnDefs : [
        {
          'targets': 1,
          // 'createdCell':  function (td, cellData, rowData, row, col, m) {
          //      $(td).attr('id', 'cell-' + m); 
          //      m = m + 1;
          // }
          // "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
          //   $(nTd).attr('name', 'tdPoNo' + iRow); 
          // }
          render : function(data, row) {
            return '<input type="text" style="" value="'+data+'" name="child">';
          }
        }
    });

});

function append_tpo(jpoNo){
    t.row.add( [
        i,
        jpoNo
    ] ).node().id = 'myId';
    t.draw( false );
}

Replies

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @Addison ,

    I don't follow the question, sorry. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • AddisonAddison Posts: 13Questions: 4Answers: 0

    Alright. Thank you Colin :)

This discussion has been closed.