title: How do I access object field by variable in template?
body: <p>I have a nested loop:</p>
  
  <pre><code>{{$columns := .columns}}
  {{range $dx := .dataList}}
      {{range $c := $columns}}
          {{index $dx $c}}
      {{end}}
  {{end}}
  </code></pre>
  
  <p>dataList is the orm model array. With <code>ID, Title</code> fields , then <code>columns</code> is the <code>[]string</code> variable contains all orm model field names like <code>ID, Title</code>.</p>
  
  <pre><code>type AdFile struct {
      ID      uint `gorm:"primary_key"`
      Title   string
  }
  </code></pre>
  
  <p>I've tried with <code>{{(index .listData 0).Title}}</code> and it works.</p>
  
  <p>But if i want to access <code>$dx.Title</code>, <code>$dx.ID</code> .... with <code>Title</code>, <code>ID</code> as variables, but it doesn't work. I've tried <code>$dx[$c]</code>.</p>
  
  <p>Can achieve the same thing with Python easily</p>
  
  <pre><code>for i in list_data
      tr
          for p in columns
              td=i[p]
  </code></pre>