0

Dynamically set grid columns at run time?

asked 2019-06-12 01:31:31 +0800

davout gravatar image davout
1435 3 18

Is it possible to dynamically drive the number of columns in a grid component using an MVVM model array property?

My challenge is to display a variable number of numeric data columns for showing month totals for different times of the year.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-06-14 12:36:19 +0800

cor3000 gravatar image cor3000
4546 2 7
ZK Team

Yes thss is possible. Assuming your array size is determined when the ViewModel initializes (which can be a varying length each time). Then the most efficient way is to use the special-attribute forEach to iterate over an array/collection and output the same number of <column> and <cell> components as items in the array.

If you need to dynamically add, remove columns/cells at runtime -> use a ListModelList and children binding instead.

For ZK EE the shadow element <forEach> offers additional flexibility (for both static and dynamic iteration).

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2019-06-12 01:31:31 +0800

Seen: 7 times

Last updated: Jun 14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More