Message from JavaScript discussions

September 2020

— Hi guys, I can't seem to figure out how to extract a cell value from an HTML table as I iterate through the table with JavaScript. I am using the following to iterate

Message permanent page

— 

if (table !== null) {
while (row = table.rows[r++]) {
var c = 0;
while (cell = row.cells[c++]) {
var cellValue = cell.innerHTML;
if (c === 5 && cellValue > 25) {
console.log("rows 2" + c);
cell.style.backgroundColor="#FF0000";
} else if (c === 5 && cellValue >= 10 && cellValue < 25) {
cell.style.backgroundColor="#FFFF00";
}
}
}

— I am only getting [object HTMLTableRowElement] no values

— You only use jwt to authenticate with the server. If you know the key to decrypt jwt, you can elevate your own permissions.

Message permanent page

— Jwt🤔 you mean hash😅 decode a hash or wat i don't get it sorry

— Rephrase it again, you need to form a question

— Hi determin1st I am trying to format JSON data being displayed on a table. Here is what I am trying to achieve, for empty rows, instead of being blank , I fill them with a hyphen, values greater than 25 I fill there individual cells background with red color, values between 20 and 25 I fill them with yellow color, but for some weird reason my table is not being formatted completely, it is like it is not detecting the ngAfterViewInit() function

Message permanent page

— You already use a framework, you should not manually go through the DOM and change things (Angular will wipe them on a redraw), you should use Angulars built-in HTML templating engine to decide when to use which style

Message permanent page

— E.g. <td><template ng-if="!data">NO DATA</template></template ng-else>{{ data }}</template></td>

— Ye, right☝️ was cleaning my keyboard and desk, took the Infinity🤤.. well, if you like to step away from automation framework, the mechanistic data structure is where to start from, DOM is a tree, so the JSON is.. then you do a simplified tree traversal node.firstChild.firstChild.children[2] and get those cells (in case of SSR)..

Message permanent page

— Oh god please no

— Why not some refreshing experience🤤