<!DOCTYPE html>
<html>
  <head>
    <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
    <link href="https://nightly.datatables.net/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
    <script src="https://nightly.datatables.net/js/jquery.dataTables.js"></script>
<link href="https://nightly.datatables.net/select/css/select.dataTables.css" rel="stylesheet" type="text/css" />
<script src="https://nightly.datatables.net/select/js/dataTables.select.js"></script>
    <meta charset=utf-8 />
    <title>DataTables - JS Bin</title>
  </head>
  <body>
    <div class="container">
      <button id="addRow">Add new row</button>
      <table id="table3" class="display nowrap" width="100%"></table>
    </div>
  </body>
</html>
 
body {
  font: 90%/1.45em "Helvetica Neue", HelveticaNeue, Verdana, Arial, Helvetica, sans-serif;
  margin: 0;
  padding: 0;
  color: #333;
  background-color: #fff;
}
 
$(document).ready( function () {
  var Table3 = $('#table3').DataTable({
        columns: [
            {
                data: null,
              defaultContent: '',
                title: "Select",
                orderable: false,
                className: "select-checkbox"            
            },
            { data: null, title: "ResponsibilityID" },
            { data: null, title: "Responsibility" }
        ]   ,
            select: {
            style: 'multi',
            selector: 'td:first-child'
        }  
  });
  
    $('#addRow').on('click', function () {
//        var data = arrResponsibilities.responseJSON.data;
var data = 
    [
    {
        "DT_RowId": "row_50022",
        "RESPONSIBILITY_ID": 50022,
        "RESPONSIBILITY_NAME": "STAN CASH MANAGEMENT SUPERUSER",
        "CategoryID": 6
    },
    {
        "DT_RowId": "row_50023",
        "RESPONSIBILITY_ID": 50023,
        "RESPONSIBILITY_NAME": "STAN CASH MGT TREASURY",
        "CategoryID": 5
    },
    {
        "DT_RowId": "row_50024",
        "RESPONSIBILITY_ID": 50024,
        "RESPONSIBILITY_NAME": "STAN CASH MGT RECONCILIATION",
        "CategoryID": 5
    }
];
      
      Table3.rows.add(data).draw();
    });
  
  
  } );
Output

This bin was created anonymously and its free preview time has expired. Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers