From 9307c0d8e819494f0492ee3b0e17388b066741f4 Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 31 Jul 2018 07:29:32 +0000 Subject: Added header row to table. --- www/scripts/main.js | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'www/scripts') diff --git a/www/scripts/main.js b/www/scripts/main.js index f75f23c..f9fe22f 100644 --- a/www/scripts/main.js +++ b/www/scripts/main.js @@ -1,5 +1,11 @@ -var globalDb = []; +// var globalDb = []; +var globalDb = [ +{id:1, description: "Test 1", username: "user1", password: ""}, +{id:2, description: "Test 2", username: "user2", password: ""}, +{id:3, description: "Test 3", username: "user3", password: ""}, +{id:4, description: "Test 4", username: "user4", password: ""} +]; var globalGroups = []; var globalCurrentGroup = ""; @@ -316,6 +322,44 @@ function AddRow(table, id, prev_id, next_id, desc, username, password, rowcount) table.appendChild(tr); } +function AddHeaderRow(table, rowcount) +{ + var tr = document.createElement("tr"); + + if ((rowcount % 2) == 1) + { + tr.className = "style1"; + } + else + { + tr.className = "style2"; + } + + var td; + + td = document.createElement("td"); + td.className = "description"; + AddText(td, "Description"); + tr.appendChild(td); + + td = document.createElement("td"); + td.className = "username"; + AddText(td, "Username"); + tr.appendChild(td); + + td = document.createElement("td"); + td.className = "password"; + AddText(td, "Password"); + tr.appendChild(td); + + td = document.createElement("td"); + td.className = "commands"; + AddText(td, "Commands"); + tr.appendChild(td); + + table.appendChild(tr); +} + function GetGroupRows() { var result = []; @@ -339,6 +383,8 @@ function LoadTable() var rowcount = 0; + AddHeaderRow(table, rowcount++); + var rows = GetGroupRows(); for(var f = 0; f < rows.length; f++) @@ -412,6 +458,7 @@ function DoLoad() } WebRequest("get.php", DoLoadAsync, []); + LoadInitialData(); } function DoChangePassphraseAsync() -- cgit v1.2.3