This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Add objects to Visu by Tag
#4
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>
Reply


Messages In This Thread
Add objects to Visu by Tag - by tomnord - 28.12.2022, 07:12
RE: Add objects to Visu by Tag - by admin - 28.12.2022, 07:18
RE: Add objects to Visu by Tag - by tomnord - 28.12.2022, 11:00
RE: Add objects to Visu by Tag - by admin - 28.12.2022, 11:38

Forum Jump: