title: How I could create a table model with closure put multiple variable form loop
body: <p>I see this code for how create a table with closure </p>
  
  <p><a href="https://varomorf.wordpress.com/2014/09/22/update-jtable-using-groovy/" rel="nofollow noreferrer">https://varomorf.wordpress.com/2014/09/22/update-jtable-using-groovy/</a></p>
  
  <p>but now I need create a table with closure </p>
  
  <p>but using a text title for create all closure variable</p>
  
  <p>like this; this code get the table but using the last value of xbn in this <strong>case 4</strong></p>
  
  <pre><code> theTable = table(){
          tableModel(){
  var1="fecha"
  xbn=0
  stx="date;product;quant;weight;price".split(";")
  println it
  while(xbn&lt;4) {
            closureColumn(header:stx[xbn], read:{it[stx[xbn]]})   ;xbn=xbn+1  }
  
  
  
          }
        }
  </code></pre>
  
  <p>normally my code without loop </p>
  
  <p>look like this</p>
  
  <pre><code> theTable = table(){
          tableModel(){
  var1="fecha"
  xbn=0
  stx="date;product;quant;weight;price".split(";")
  println it
  
            closureColumn(header:"date", read:{it["date"]})    
            closureColumn(header:"product", read:{it["product"]})    
                closureColumn(header:"quant", read:{it["quant"]})    
                closureColumn(header:"weight", read:{it["weight"]})    
                closureColumn(header:"price", read:{it["price"]})    
  
          }
        }
  </code></pre>
  
  <p>please help me</p>