title: Binding Table data in Go Fyne
body: <p>Fyne beginner here.</p>
  <p>There is simple use case I'm trying to solve, without finding any solution in the docs: in Fyne, <strong>how to have a Table widget, with its data bound to a data source?</strong></p>
  <p>In other words, we have the <code>binding.BindStringList</code> <a href="https://developer.fyne.io/tour/binding/list" rel="nofollow noreferrer">in the docs</a>, that allows to bind a list of strings…</p>
  <pre class="lang-golang prettyprint-override"><code>data := binding.BindStringList(
      &amp;[]string{&quot;Item 1&quot;, &quot;Item 2&quot;, &quot;Item 3&quot;},
  )
  </code></pre>
  <p>…I am looking for something similar that would allow to <strong>bind a list of structs</strong> instead of string. For example, a table of todos:</p>
  <pre class="lang-golang prettyprint-override"><code>type Todo struct {
    UserID    int    `json:&quot;userId,omitempty&quot;`
    ID        int    `json:&quot;id,omitempty&quot;`
    Title     string `json:&quot;title,omitempty&quot;`
    Completed bool   `json:&quot;completed,omitempty&quot;`
  }
  </code></pre>
  <p>If it is not possible, what would seem like the best workaround for you?</p>
  <hr />
  <p>Well, following Andy's suggestion, I tried this:</p>
  <pre><code>var data []Todo
  
  stringData := `[{&quot;userId&quot;:1,&quot;id&quot;:1,&quot;title&quot;:&quot;delectus aut autem&quot;},{&quot;userId&quot;:1,&quot;id&quot;:2,&quot;title&quot;:&quot;quis ut nam facilis et officia qui&quot;}]`
  json.Unmarshal([]byte(stringData), &amp;data)
  
  var bindings []binding.DataMap
  
  for _, todo := range data {
    bindings = append(bindings, binding.BindStruct(&amp;todo))
  }
  
  list := widget.NewTable(
    func() (int, int) {
      return len(bindings), 4
    },
    func() fyne.CanvasObject {
      return widget.NewLabel(&quot;wide content&quot;)
    },
    func(i widget.TableCellID, o fyne.CanvasObject) {
      title, _ := bindings[i.Row].GetItem(&quot;Title&quot;)
      log.Println(title)
      o.(*widget.Label).SetText(title)
    }
  )
  </code></pre>
  <p>I don't manage to access the actual values of my elements (i.e. Title). Could you help?</p>