I am using thymeleaf and I want to move my table rows based on it's value using Javascript or Jquery.
If the values in is "BAD" delete that row from current table and move that row to the bad table. I don't have classes on the table because the <TD>
is dynamically inserted using thymeleaf foreach: iterate.
Is it possible to do all this onload?
I was attempting to duplicate and delete all rows with the first column that have value "BAD" and then inserted into a different table, but I am having trouble writing a script that looks for the first value.
Html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<!--<meta http-equiv="refresh" content="1" />-->
<link href="../static/css/style.css"
th:href="@{css/style.css}" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="container">
<div class="jumbotron">
<h3 style="color:yellow;">
BAD/WARNING
</h3>
<h3>
APPLICATION PROCESSING MONITORING
</h3>
<table id="tablePmBad">
<tr>
<th> Status </th>
<th> HostName </th>
<th> Process Name </th>
<th> Process Count </th>
</tr>
<tr>
<td> BAD </td>
<td> Host1 </td>
<td> process1</td>
<td> 0 </td>
</tr>
</table>
<h3 style="color:green;">
GREEN/NORMAL
</h3>
<h3>
APPLICATION SERVER
</h3>
<table id="tablePmGreen">
<tr>
<th> Status </th>
<th> Host </th>
<th> Cpu Memory </th>
<th> App Memory </th>
<th> Opt Memory </th>
</tr>
<tr th:each="datamem", iterStat : ${datalist}">
<td th: "${datamem.status}"></td>
<td th: "${datamem.host}"></td>
<td th: "${datamem.cpuMem}"></td>
<td th: "${datamem.appMem}"></td>
<td th: "${datamem.optMem}"></td>
</tr>
</table>
<h3>
MONITORING
</h3>
<table id="tableMGreen">
<tr>
<th> Status </th>
<th> HostName </th>
<th> Process Name </th>
<th> Process Count </th>
</tr>
<tr th:each="data, iterStat : ${countlist}">
<td th: "${data.Status}"> </td>
<td th: "${data.host}"> </td>
<td th: "${data.pName}"></td>
<td th: "${data.pcount}"></td>
</tr>
</table>
<script src="../static/css/color.js" type="text/javascript" th:src="@{css/color.js}"></script>
</div>
</div>
</body>
</html>