Javascript part :
var webservice = cyServerName + cyPath + cyWebSvc +"?r=readprocess";
CYExec(
{
url: webservice,
sync: false,
callbackok: function(ret, status)
{
if (ret < 0)
var process = new Object();
else
var process = JSON.parse(ret);
CYDataTable("IDtableusers5", { columns: pcolumns, data: process }, true);
// Excel export
$("#IDexcel1").show().on("click", function ()
{
var webservice = cyServerName + cyPath + cyWebSvc;
CYURL(webservice, { data: { r: "json2excel", header: "user;pid;cpu;mem;vsz;rss;tty;stat;start;time;command", lines: JSON.stringify(process), download: "process.xlsx" } });
});
}
});
HTML part :
<div class="ClassPanel">
<l>
Simple real live process table
</l>
<div class="ClassPanelIconsRight">
<i title="Excel export" id="IDexcel1" class="fa fa-file-excel-o" style="cursor: pointer; display: none"></i>
</div>
</div>
<div class="ClassDivTable">
<table class="ClassDataTable" id="IDtableusers5" data-page-length='5' data-paging='true' data-searching='true' data-ordering='true' data-info='true' data-order='[[ 0, "asc" ]]' data-selectauto='false' data-selectcolumns='true'>
<thead>
<tr>
<th>
user
</th>
<th>
pid
</th>
<th>
cpu
</th>
<th>
mem
</th>
<th>
vsz
</th>
<th>
rss
</th>
<th>
tty
</th>
<th>
stat
</th>
<th>
start
</th>
<th>
time
</th>
<th>
command
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>