JSFiddle - React, Tailwind, and code Playground
by friek2k
HTML
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.0.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.js"></script>
<link rel="stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css">
<table border="0" class="display" id="example"></table>
JavaScript
function addOnClick() {
alert('ss');
$.each($oTable.find('tr'), function (i) {
debugger;
var rowData = $oTable.fnGetData(this);
if (rowData) {
var propertyName = rowData[0];
var device = rowData[1];
var nodeId = rowData[2];
$(this).find('button[name=set]').on('click', function (event) {
event.preventDefault();
setPropertyValue(propertyName, device, nodeId);
});
}
});
}
/*
Creates the grid after page is ready
*/
$(document).ready(function () {
$oTable = $('#example').dataTable({
"bJQueryUI": false,
"bProcessing": true,
"bPaginate": true,
"bFilter": true,
"bInfo": true,
'fnDrawCallback': function (oSettings) {
if (typeof $oTable == 'undefined')
return;
addOnClick();
},
"aoColumns": [{
"bSortable": true,
"bVisible": true,
"bSearchable": true,
"sTitle": "testcol",
"sType": "string",
"sWidth": null,
"sClass": "center",
"asSorting": ["asc", "desc"]
}, {
"bSortable": true,
"bVisible": true,
"bSearchable": true,
"sTitle": "testcol2",
"sType": "string",
"sWidth": null,
"sClass": "center",
"asSorting": ["asc", "desc"]
}, {
"bSortable": true,
"bVisible": true,
"bSearchable": true,
"sTitle": "testcol3",
"sType": "string",
"sWidth":...