var dtLang = {
"sProcessing": "处理中...",
"lengthMenu": '显示 ' + '5 ' + '20 ' + '100 ' + '全部 ' + ' 项结果',
"sZeroRecords": "没有匹配结果",
"sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
"sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
"sInfoFiltered": "(由 _MAX_ 项结果过滤)",
"sInfoPostFix": "",
"sSearch": "搜索:",
"sUrl": "",
"sEmptyTable": "表中数据为空",
"sLoadingRecords": "载入中...",
"sInfoThousands": ",",
"oPaginate": {
"sFirst": "首页",
"sPrevious": "上页",
"sNext": "下页",
"sLast": "末页"
}
,
"oAria": {
"sSortAscending": ": 以升序排列此列",
"sSortDescending": ": 以降序排列此列"
}
};
var tableHead = "
序号 PublicKey 备注 管理 ";
var tableTail = "
";
var fillAcceptList = function(data) {
console.log("fillAcceptData");
var html = tableHead;
var lines = data;
var i = 1;
for (var k in data) {
html += "";
html += i;
html += " ";
html += k;
html += " ";
html += data[k];
html += " ";
html += "取消授权 ";
html += " ";
i++;
}
html += tableTail;
$("#authoriedDiv").html(html);
$("#authoriedDiv").off("click", ":button").on(
"click",
":button",
function(event) {
var pos = ($(this).closest("tr").find("td").eq(0)
.text() - 1) / 1;
var pubKey = $(this).closest("tr").find("span")[0].getAttribute("title");
executeCurrentContract("cancel",pubKey,flushAllList);
}
);
$("#authorizedUsersTab").DataTable({
"language": dtLang,
"rowCallback": function(row, data, displayNum, displayIndex, dataIndex) {
}
,
"headerCallback": function(thead, data, start, end, display) {
$(thead).css("background", primaryColor);
$(thead).css("color", "white");
$(thead).children().css("background", primaryColor);
$(thead).children().css("color", "white");
}
,
scrollCollapse: false,
paging: true,
pageLength: 5,
order: [[1, 'asc']],
"columnDefs": [
{
"targets": 1,
"render": function(data, type, row, meta) {
if (data.length > 15) return "" + data.substring(0, 15) + " ... ";
else return data;
}
}, {
"targets": 2,
"render": function(data, type, row, meta) {
if (data.length > 40) return "" + data.substring(0, 40) + " ... ";
else return data;
}
}
]
}
);
};
var tableApplyHead = "序号 PublicKey 备注 管理 ";
var tableApplyTail = "
";
var fillApplyData = function(data) {
console.log("fillApplyListData");
var html = tableApplyHead;
var i=1;
for (var k in data) {
html += "";
html += i;
html += " ";
html += k;
html += " ";
html += data[k];
html += " ";
html += "通过申请 ";
html += " ";
}
html += tableTail;
$("#unauthoriedDiv").html(html);
$("#unauthoriedDiv").off("click", ":button").on(
"click",
":button",
function(event) {
var pos = ($(this).closest("tr").find("td").eq(0)
.text() - 1) / 1;
var pubKey = $(this).closest("tr").find("span")[0].getAttribute("title");
executeCurrentContract("accept",pubKey,flushAllList);
}
);
console.log("tryToCall DataTable");
$("#applyListTab").DataTable({
"language": dtLang,
"rowCallback": function(row, data, displayNum, displayIndex, dataIndex) {
}
,
"headerCallback": function(thead, data, start, end, display) {
$(thead).css("background", primaryColor);
$(thead).css("color", "white");
$(thead).children().css("background", primaryColor);
$(thead).children().css("color", "white");
}
,
scrollCollapse: false,
paging: true,
pageLength: 10,
order: [[1, 'asc']],
"columnDefs": [
{
"targets": 1,
"render": function(data, type, row, meta) {
if (data.length > 15) return "" + data.substring(0, 15) + " ... ";
else return data;
}
}, {
"targets": 2,
"render": function(data, type, row, meta) {
if (data.length > 40) return "" + data.substring(0, 40) + " ... ";
else return data;
}
}
]
}
);
};