-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some JS for populating the devide list page
*Needs reworking to be applicable to the current entry format
- Loading branch information
Showing
2 changed files
with
28 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,36 @@ | ||
var tableHtml = processDeviceData(harvestDevices); | ||
alert(tableHtml); | ||
document.getElementById("list").innerHTML = tableHtml; | ||
|
||
console.log(harvestDevices()); | ||
|
||
|
||
function processDeviceData(devices) { | ||
// returns html table entries using data from harvestDevices() | ||
// this is to be inserted into the table with the data-table attribut 'list', which can be found in deviceListing.html | ||
var html=""; | ||
for (var i = 0; i<devices.length; i++) { | ||
html+="<tr>"; | ||
for (var j = 0; j < devices[i].length; j++) { | ||
// if(i==0) html+="<th>"; | ||
// else | ||
html+="<td>"; | ||
html+=devices[i][j]; | ||
// if(i==0) html+="</th>"; | ||
// else | ||
html+="</td>" | ||
console.log(html); | ||
} | ||
html+="</tr>"; | ||
} | ||
return html; | ||
} | ||
function harvestDevices() { | ||
// returns array of arrays (currently dummy data) | ||
// each array corresponds to a line item in device listing table | ||
var array = [ | ||
["Name","Device Type","Version/OS","Location"], | ||
["Name1","Type1","Version1","Location1"], | ||
["Name2","Type2","Version2","Location2"], | ||
["Name3","Type3","Version3","Location3"], | ||
["Name4","Type4","Version4","Location4"] | ||
]; | ||
]; | ||
return array; | ||
} |