我有一个包含字符串列表的事实。我正在尝试从此列表的内容中触发另一个规则,这些规则正在被其他规则更改。
我有一个填充规则,如下所示:
<html>
<head>
<title>My homepage</title>
<style>
body { background-color: coral;
font-family: vernada;
}
table { border: 3px solid white;
border-collapse: collapse;
width: 75%;
}
div {
background-color: yellow;
padding: 200px;
display: none;
}
td, th { border: 3px solid white;
font-family: helvetta;
}
tr:nth-child(even){
background-color:blue;
}
tr:hover {
background-color:gray;
}
span:hover + div {
display: block;
</style>
<body>
Employee First Name:<input type="text" name="efname" id="fname"><br><br>
Employee Last Name:<input type="text" name="elname" id="lname"><br><br>
Age:<input type="text" name="age" id="age"><br><br>
<table id = "table">
<tr>
<th>Employee First Name</th>
<th>Employee Last Name</th>
<th> age</th>
</tr>
<span>
<tr>
<div> Leo Dicaprio is 50 years old </div>
<td>Leo</td>
<td>DiCaprio</td>
<td>50</td>
</tr>
</span>
<span>
<tr>
<div> Jill smith is 50 years old </div>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
</span>
<span>
<tr>
<div> Eve jackson is 94 years old</div>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</span>
<span>
<tr>
<div> John Doe is 80 years old</div>
<td>John</td>
<td>Doe</td>
<td>80</td>
</tr>
</span>
</table>
<button onclick="myfunction()">Add data</button>
<input type = "image" src = addimage()>
<script>
var table = document.getElementById('table');
for(var i = 1; i < table.rows.length; i++)
{
table.rows[i].onclick = function()
{
document.getElementById("fname").value = this.cells[0].innerHTML;
document.getElementById("lname").value = this.cells[1].innerHTML;
document.getElementById("age").value = this.cells[2].innerHTML;
}
}
function myfunction() {
var table = document.getElementById('table');
var row = table.insertRow(1);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
var cell3 = row.insertCell(2);
cell1.innerHTML=(document.getElementById("fname").value);
cell2.innerHTML=(document.getElementById("lname").value);
cell3.innerHTML=(document.getElementById("age").value);
}
</script>
</body>
</html>
还有另一条永不触发的规则,如下所示:
rule "PopulateList"
when
fact: MyFact(ls: stringList, ls.size() == 0 )
then
ls.add("test2");
update(fact);
end
此规则永远不会触发。我将如何构造此结构以根据列表内容的更改触发CheckList?