I am making a table that is auto populated via database and using angular to loop through a list to populate the html table. My issue is that I would like to make it so onclick a cell it would open up a new webpage with a more specific quarry relating to that jobID.
Not my question is how do I get the values from a html table through javascript. I think i can make everything else happen if I can click on the cell I want and put the jobID into a var.
<div align=center>
<img src = "./img/heatmap.png"></img>
</div>
<div align=center>
Job ID:<input type="text" name="jobID" id="jobID"><br><br>
</div>
<div align=center>
<table id="Table" class="JobID-table" style="text-align:center" >
<tr class="table-Header">
<th>JOB ID</th>
<th>TIME FOR ALL MODULES(MILLISECONDS)</th>
</tr>
<tr class="jobID-Table-tr" ng-repeat="p in puller | orderBy : '-modCount'">
<td ng-click='someFunctionName(p.modName)'class={{p.cellClass}}>
{{p.modName}}
</td>
<td class={{p.cellClass}}>
{{p.modCount}}
</td>
</tr>
</table>
</div>
<script src = "js/vendor/angular.js"></script>
<script src = "js/app.js"></script>
<script src = "js/home-controller.js"></script>
This is the controller:
app.controller("homectrl", function($scope, $http){
$http.get("rest/performance").then(function(response){
$scope.puller = response.data;
for (var i = 0; i < $scope.puller.length; i++) {
var p = $scope.puller[i];
console.log("modName: " + p.modName);
console.log("modClass: " + p.cellClass);
console.log("modData: " + p.modCount);
}
$scope.someFunctionName(cellVal){
document.getElementById("jobID").value = cellval;
}
});
});