Table with PUG in Nodejs

Asked

Viewed 139 times

0

I am using PUG template in Nodejs and I am looking in the documentation how to assemble a table. I am checking in "pugjs.org", but apparently there is... Does anyone know how to mount a table with PUG?

1 answer

1


do as with other parameters

table.table
    thead
        tr
            th Exemplo
            th Exemplo2
    tbody
        tr
            td
            td
        tr
            td
            ....

If you want to do it with dynamic data, use each.

table.table(class=type)
    thead
        tr
            each head, i in header
                th #{head}
    tbody
        each row,j in data
            tr
                each col,k in row
                    td #{col}
  • Gabriel, thank you for the information. The first example worked without problems, but I need your second example, that is, dynamically. One of the problems I’m having is how to dynamically define "colspan" and "rowspan", for example. Could you share the documentation link about Tables in the PUG? I’m really not finding it in "pugjs.org".

Browser other questions tagged

You are not signed in. Login or sign up in order to post.