Hi,
I need a grid which contains 2 subsets of columns:
- A subset of permanents columns : the columns are always the same
- A subset of variables columns : The number of columns can vary
i.e:
Name | City | Country | Period 1 | Period 2 | Period 3 |
---|---|---|---|---|---|
John | Paris | France | 10 | 4 | 23 |
or
Name | City | Country | Period 1 | Period 2 | Period 3 | Period 4 | Period 5 |
---|---|---|---|---|---|---|---|
John | Paris | France | 10 | 4 | 23 | 2 | 56 |
So I set up my bryntum grid with the ajaxStore, and my backend send something like this :
{
"data": [
{
"name": "John",
"city": "Paris",
"country": "France",
"periods": [
{
"id": 22,
"position": 1,
"value": 10
},
{
"id": 23,
"position": 2,
"value": 4
},
{
"id": 24,
"position": 3,
"value": 23
},
]
}
]
}
Now I need a way to map each item of the periods
array to a dedicated column.
I tried this but without success:
columns: [
{ field: 'name', text: 'Name' },
{ field: 'city', text: 'City' },
{ field: 'country', text: 'Country' },
{ field: 'periods[0].value', text: 'period 1' },
{ field: 'periods[1].value', text: 'period 2' },
{ field: 'periods[2].value', text: 'period 3' },
]
Is there a way to achieve this without changing the structure of the ajax response?
Thx