Currently there is no way to use MVVM where a grid, listbox or tree requires a variable number of data columns. The limitations are two fold:
- You can't use a template or similar method to set a collection of columns
- I don't think its possible to use binding to reference a VM data property by index, like @load(vm.data(1).name)
The example I'd use to validate this proposal would be for a grid to display data for two entities where the number of entities for each dimension is unknown at the time of building the ZUL. For example, assume that I want to use a grid to display product sales (rows) across markets (columns), then the columns would be something like:
column 0 : product name
column 1 : product category
column 2 : total - all markets
column 3 : market #1
column 4 : market #2
column 5 : market #3
...
...
column m : market #n
When addressing this requirement I think its pretty standard to have a mix of static columns (like columns 0 to 2 above) and dynamically created columns (column 3 and beyond).