lundi 20 février 2017

Filter Table (Data from database) with Checkboxes

I have got a table with data from a database.First of all i load the the data in the backend (java) and giving it to the frontend, there i have a controller written in typescript and then i have the HTML Code where i show the table with the data.

And now to my question: I want to filter the data with checkboxes. There are 4 diffrent options red, yellow, green and black. My variable is called "led" and i only want to show the colors, which are selected. I already tried it with a function in my controller, but i made a mistake (unfortunately i don't have the code anymore). So can somebody help me with my problem?

<div>
    <input type="checkbox" checked="checked" id="green" name="color" value="green">
    <label for="green"> Green</label><br> 
    <input type="checkbox" checked="checked" id="red" name="color" value="red">
    <label for="red"> Red</label><br> 
    <input type="checkbox" checked="checked" id="yellow" name="color" value="yellow">
    <label for="yellow"> Yellow</label><br> 
    <input type="checkbox" checked="checked" id="black" name="color" value="black">
    <label for="black"> Black</label> 
  </div>
  <table>
  <thead>
    <tr>
      <th>No.</th>
      <th>Color</th>
    </tr>
  </thead>
  <tbody>
    <tr ng-repeat="co in $ctrl.colors">
      <td></td>
      <td></td>
    </tr>
  </tbody>
  



Aucun commentaire:

Enregistrer un commentaire