mercredi 26 juillet 2017

How to delete selected rows of an html table based on a checkbox column using Javascript

I have made a simple html table with a column of checkboxes, as well as some other columns. Above that, is a delete button that will call a service function I have already made, but I want it to delete every checked box that the column has. How would I send my delete function an array of checked "projects"?

Below is the delete button code:

<div class="panel-body">
    <button class="btn pull-right btn-danger button-project-request form-group" value="Submit" ng-click=deleteCheckedProjects()>Delete</button>
</div>

Below is the table code:

    <tbody>
        <tr ng-repeat="project in projects">
            <td><input type="checkbox" name="checkbox" value="project"/></td>
            <td ng-click=editRequestModule(project)></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
    </tbody>

Any advice on how to go about this? Maybe in Javascript, establish a two way bounded array that holds all the checked boxes? Thanks.




Aucun commentaire:

Enregistrer un commentaire