Jade - how to create a table



  • How to create an HTML code using Jade.

    <table>
    <tr>
      <th>#</th>
      <th><input type="checkbox"></th>
      <th>User</th>
    </tr>
    <tr>
      <td>1</td>
      <td><input type="checkbox"></td>
      <td>haacki47</td>
    </tr>
    

    I'm using a compilator gulp-jade.
    Of course, it's possible to create a table using that code for Jade.

    table
    tr
      th #
      th
        input(type='checkbox')
      th User
    tr
      th 1
      th
        input(type='checkbox')
      th haacki47
    tr
      th 2
      th
        input(type='checkbox')
      th Newuser
    

    But it's not gonna be practical, I'd like to make such a table using cycles and something, I don't know what it is. I knew I would. I'm asking for your help.



  • table
        each ent, num in [{"id": "#", "nick": "User"}]
            tr
                th= ent.id
                th: input(type='checkbox')
                th= ent.nick
    
        each ent, num in [{"id": "1", "nick": "haacki47"}, {"id": "2", "nick": "Newuser"}]
            tr
    
                td= ent.id
                td: input(type='checkbox')
                td= ent.nick
    

    http://codepen.io/Zoxon/pen/vLNWwe


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2