Example using [karax](https://github.com/pragmagic/karax), `jstable.nim`:
    
    
    import tables
    include karax / prelude
    
    type
      MyRow = tuple[a, b, c: int]
      MyTable = seq[MyRow]
    
    
    proc createDom(): VNode =
      let t = @[(1, 2, 3).MyRow, (4, 5, 6), (7, 8, 9)]
      result = buildHtml(tdiv):
        table:
          tr:
            for k, _ in t[0].fieldPairs:
              th text k
          for r in t:
            tr:
              for c in r.fields:
                td text $(c)
    
    setRenderer createDom
    
    
    Run

Compile and run with `karun -r jstable`.

Reply via email to