GriddleGriddle / Griddle

Simple Grid Component written in React
http://griddlegriddle.github.io/Griddle/
MIT License
2.5k stars 377 forks source link

Cannot access array from nested data #803

Closed visinescu13 closed 6 years ago

visinescu13 commented 6 years ago

Griddle version

1.11.2

Expected Behavior

{
    "a": {
        "b": [
          {
            "c": "text"
          },
          {
            "d": "text"
          }
        ]
    }
}

Use:

<Griddle
        data={data}
        plugins={[plugins.LocalPlugin]}
      >
        <RowDefinition>
          <ColumnDefinition id="a.b[0].c" title="Test" />
        </RowDefinition>
</Griddle>

or

<Griddle
        data={data}
        plugins={[plugins.LocalPlugin]}
      >
        <RowDefinition>
          <ColumnDefinition id="a.b[1].d" title="Test" />
        </RowDefinition>
</Griddle>

Actual Behavior

No data appear when I try to access the data from array as mentioned above.

dahlbyk commented 6 years ago

Try a.b.0.d? Nested values are accessed by splitting on ..

visinescu13 commented 6 years ago

Thank you very much, it worked.