Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function insertObject() {
- var data = [{
- "nodeid": 1,
- "vendor": "0x0345,0x0342,0x0323,0x0321",
- "product_id": "",
- "product_type": "",
- "home_id": "0xD087E344",
- "secure": "1",
- "button" : "-",
- },
- {
- "nodeid": 2,
- "vendor": "0x0285",
- "product_id": "",
- "product_type": "",
- "home_id": "0xD087D213",
- "secure": "0",
- "button" : "-",
- },
- { "nodeid": 3,
- "vendor": "0x1145",
- "product_id": "",
- "product_type": "",
- "home_id": "0xD034T13",
- "secure": "0",
- "button" : "-",
- },
- { "nodeid": 4,
- "vendor": "0x8992",
- "product_id": "",
- "product_type": "",
- "home_id": "0xD0682F13",
- "secure": "1",
- "button" : "-",
- }
- ];
- var text=[];
- var tbl = document.getElementById('tableData');
- var tblBody = document.createElement('tbody');
- for (var i = 0; i < data.length; i++) {
- var split =data[i].vendor.split(",");
- data[i]["vendor"]=split[0];
- data[i]["product_id"]=split[1];
- data[i]["product_type"]=split[2];
- var row = document.createElement('tr');
- for (var value in data[i]) {
- var cell = document.createElement("td");
- var cellText = document.createTextNode(data[i][value]);
- cell.appendChild(cellText);
- row.appendChild(cell);
- }
- tblBody.appendChild(row);
- }
- tbl.appendChild(tblBody);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement