jquery - Get values from an HTML table row and pass them to a modal -
im trying make webpage has table , user must able click on filtered row or non-filtered row , modal should pop displaying more info selected row.
here main code (table included)
<body ng-app="mainapp"> <h1>issues repository</h1> <div class="container-1"> <span class="icon"><i class="fa fa-search"></i></span> <input type="search" id="search" ng-model="searchbox" placeholder="buscar..." /> </div> <div> </div> <div id="divbuscador" ng-controller="issues"> <table class="table table-striped" id="tablelist" cellspacing="0" border=1> <tr> <th>opco</th> <th>tecnologia</th> <th>version</th> <th>titulo del issue</th> <th>estado</th> </tr> <tr class='clickable-row' data-target="#contentmodal" style="cursor:pointer" id="issuelist" ng-repeat="document in documents | filter:searchbox" ng-click="openmodal(documents)"> <td id="opco_val">{{ document.opco}}</td> <td id="tec_val">{{ document.tecnology }}</td> <td >{{ document.version }}</td> <td >{{ document.issue }}</td> <td >{{ document.status }}</td> </tr> </table> </div>
this function linked on-click:
jquery(document).ready(function($) { $(".clickable-row").click(function() { $('#contentmodal').modal('show'); }); });
this controller:
app.controller('issues', ['$scope', function($scope, $modal){ $scope.documents = filex.records; }]);
how can pass variables modal, {{ document.version }} or {{ document.issue }}
please explain everything, im new angular.
as understood, need data clicked row?
this code below that.
$('#example tr').click(function(){ $(this).find("td").each(function(){ alert($(this).html()); }); });
i've printed values in alert box , works perfectly. if want store each value array push lines of code:
$scope.tablerowvalues = []; $scope.tablerowvalues.push($(this).html());
inside of .each method
hope you!
Comments
Post a Comment