var buttonCancel = '<button class="btn btn-primary col-sm-12 button-cancel">Cancel</button>';
function UpdateDataSet(data){
if(data != '' && data != undefined){
data = data.map(function (obj) {
var ds = timer();
if (!obj)
return;
obj.push(ds,buttonCancel);
return obj;
});
}
if (dispatchTable) {
dispatchTable.fnDestroy();
}
dispatchTable = $('#table-dispatch').dataTable({
"data": data,
"columnDefs": [
{"sClass": "hide_me", "aTargets": [9]},
{"sClass": "hide_me", "aTargets": [10]},
]
});
}
我使用jquery.dataTables.js,我在dataTable最后一行td之后添加了数字计时器。 数据和obj来自套接字。
data = ['1','Waiting for pickup','test','9826','Apr 25, 2016 4:35 PM','akhil1 04','NaN','Thaltej ,Ahmedabad, Gujarat 380054, India','0$','0','0'] ;
obj = [1, "Waiting for pickup", "test", "9826", "Apr 25, 2016 4:35 PM", "akhil1 04", NaN, "Thaltej, Ahmedabad, Gujarat 380054, India", "0$", 0, 0];
我在对象中按下cancal按钮。这个timer()函数。
var digiclock = "00:00:00";
i = 0;
function timer() {
var digiformat = "";
if (i > 3599) {
var H = Math.floor(i / 3600);
}else {
var H = 0;
}
var M = i - (H * 3600)
if (M > 59) {
M = Math.floor(M / 60)
}else {
M = 0
}
var S = i - (M * 60)
if (H < 10) {
H = "0" + H;
}
if (M < 10) {
M = "0" + M;
}
if (S < 10) {
S = "0" + S;
}
var result = H + ":" + M + ":" + S;
return result;
setTimeout('timer()', 1000);
i++;
}
你能帮我看看如何在dataTable中的dataTable行中添加定时器,当dataTable中的记录存储时显示时间。但它需要一次,然后定时器停止不增加定时器。
In Image where timer is stop on time field 所以请帮助我。如何在dataTable中添加计时器。 提前谢谢......