Bind Grid Column Amount

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
JayGoo83
Profound User
Posts: 36
Joined: Fri Jul 17, 2020 12:52 pm
First Name: Jason
Last Name: Guzik
Company Name: 3Linc
Contact:

Bind Grid Column Amount

Post by JayGoo83 »

How come we cannot bind the amount of columns to a value in our RPG program? I would like to create tables that only show columns if set up in a parent file.
The basic gist is that a parent record can be set up with optional extra fields. The child record would then show inputs for each of the extra fields. If the parent isn't set up for the extra field than we don't give the option in the child when adding new. That part I got. But I would like have the grid showing all the children follow same logic.
I feel like I could probably create a bunch of grids with visibility bounded value, stack them on top of each other, and then toggle which view to see. But that seems sloppy, at least from a visual design POV.

Thanks in advance.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Bind Grid Column Amount

Post by Scott Klement »

Not sure why the number of columns isn't bindable. I suspect its because it'd do things like wipe out the widgets and field bindings for the columns if they were removed, and that'd cause problems at run-time. But, alas, this is just a guess.

Some customers have done similar tasks to yours using some JavaScript code. In the onload event of the screen, they call the hideColumn API to hide (rather than remove) the columns that they don't want to be displayed. For example, you could have an output field that has visibility=hidden that contains the number of columns you want to show, and the onload event could loop through and hide the extra columns based on that number.

Another alternative that I've seen used is to hide the entire grid. Then use an HTML Container widget (or similar) to draw their own grid using HTML code. The HTML Container supports EJS templating, so that can be very powerful. Obviously this requires more code and stronger web development skills.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest