![]() |
|
Add objects to Visu by Tag - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: OLD visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9) +--- Thread: Add objects to Visu by Tag (/showthread.php?tid=4467) |
Add objects to Visu by Tag - tomnord - 28.12.2022 Is it possible to auto fill a table (or similar) in visu by adding tags to objects? RE: Add objects to Visu by Tag - admin - 28.12.2022 Can you provide a picture of what you want to achieve? RE: Add objects to Visu by Tag - tomnord - 28.12.2022 (28.12.2022, 07:18)admin Wrote: Can you provide a picture of what you want to achieve? I do not have a screenshot, but to explain more detailed: If I add a tag to a object, I would like for it to automaticly be added to visu. and show value + name. Like a excel spreadsheet of sorts. RE: Add objects to Visu by Tag - admin - 28.12.2022 You can use .lp server-side script and iframe element to display a table. Upload via FTP using apps login to user directory as objects.lp Then use /user/objects.lp as iframe source. Code: <?
require('apps')
objs = grp.tag('tag_name_here')
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Objects</title>
<link rel="stylesheet" href="/apps/css/bootstrap.css">
<link rel="stylesheet" href="/apps/css/font-awesome.css">
<link rel="stylesheet" href="/apps/css/style.css">
<script src="/apps/js/jquery.js.gz"></script>
</head>
<body>
<table class="table table-hover" style="margin-bottom:0">
<thead>
<tr>
<th>Name</th>
<th>Value</th>
<th>Date</th>
</tr>
</thead>
<tbody></tbody>
</table>
<script>
var data = <?=json.encode(objs)?>;
// sort data by name
data.sort(function(a, b) {
var na = a.name.toLowerCase()
, nb = b.name.toLowerCase();
if (na > nb) {
return 1;
}
else if (na < nb) {
return -1;
}
else {
return 0;
}
});
// show each object name/value/update time
$.each(data, function(index, item) {
var trs = $('<tr><td></td><td></td><td></td></tr>').appendTo('tbody')
, tds = trs.find('td')
, d = new Date(item.updatetime * 1000);
$(tds[ 0 ]).text(item.name);
$(tds[ 1 ]).text(item.value);
$(tds[ 2 ]).text(d.toString().split(' GMT')[0]);
});
</script>
</body>
</html> |