title: grails - print each row's value with column name from GroovyRowResult
body: <p>I want to let a user fire sql query and then see the result in grails view page.</p>
  
  <p>My <code>QueryController.groovy</code> is </p>
  
  <pre><code>def query(){
      def headers = null; //["id","name"]
      Sql sql = new Sql(dataSource)
      def rowResults = sql.rows(params.query) //GroovyRowResult
      rowResults.eachWithIndex { row, index-&gt;
             if (headers == null) {
                     headers = row.keySet()
             }
      }
      [headers : headers, resultList: rowResults, total : rowResults.size() ]
  
  }
  </code></pre>
  
  <p>In grails view page (<code>query.gsp</code>), </p>
  
  <pre><code>&lt;table class="table table-striped"&gt;
             &lt;thead&gt;
                 &lt;tr&gt;
                    &lt;g:each in="${headers}" var="header"&gt;
                       &lt;g:sortableColumn property="header" title="${header}" /&gt;
                       &lt;th&gt;&lt;/th&gt;
                    &lt;/g:each&gt;
                &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;
                  &lt;g:each in="${resultList}" var="row"&gt;
                     &lt;tr&gt;
                        &lt;g:each status="counter" in="${row}" var="val"&gt;
                             &lt;td&gt;${val}&lt;/td&gt;
                        &lt;/g:each&gt;
                     &lt;/tr&gt;
                  &lt;/g:each&gt;
  
               &lt;/tbody&gt;
           &lt;/table&gt;
  </code></pre>
  
  <p>The <code>&lt;td&gt;${val}&lt;/td&gt;</code> part in view is not working as expected, because it gives result as <code>id=1</code> instead of <code>1</code>. I want only value to be displayed there.</p>
  
  <p>Might be a smaller issue though, need to fix it.</p>
  
  <p>Thanks.</p>