Adding columns to grid widget

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
ndeppe
New User
Posts: 14
Joined: Fri Dec 05, 2014 1:17 pm
First Name: Nick
Last Name: Deppe
Company Name: Victaulic
Phone: 6109233257
Address 1: 4901 Kesslersville Road
City: Easton
State / Province: Pennsylvania
Zip / Postal Code: 18040
Country: United States
Contact:

Adding columns to grid widget

Post by ndeppe »

I'm working on a program in Profound UI in which we want the users to be able to show/hide columns in a grid. They would choose which columns they want to see, and this should be saved for the next time the user opens the program. I'm having a hard time figuring out how to implement this. In looking at the Javascript API, I found there is a method removeColumn which removes a column from a grid, but I can't find anything to add a column. I could also implement this by adding all available columns to the grid, but then hiding the columns the user doesn't want to see instead of completely removing it. I would then need to be able to make a column visible if the user decides he/she wants to see it.

Any thoughts on this?
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: Adding columns to grid widget

Post by Scott Klement »

How are you going to get the data into the columns if you add them on-the-fly? You can't change the record format in the RPG application on-the-fly to add/remove fields, that has to be known at compile-time.

So I would suggest that you should output all columns. Then, the display file can potentially call the removeColumn() API that you mentioned to remove anything that's unwanted when displaying the data to the user.
ndeppe
New User
Posts: 14
Joined: Fri Dec 05, 2014 1:17 pm
First Name: Nick
Last Name: Deppe
Company Name: Victaulic
Phone: 6109233257
Address 1: 4901 Kesslersville Road
City: Easton
State / Province: Pennsylvania
Zip / Postal Code: 18040
Country: United States
Contact:

Re: Adding columns to grid widget

Post by ndeppe »

Hi Scott,

My initial thought was I would have to define all of the fields on the subfile, but it would be a matter of removing and adding column. Other than that, I could simply hide/display the columns as necessary, but there doesn't seem to be methods for hiding columns in the API.

Basically, this is what I'm looking to do: The grid displays all available columns initially. A user clicks a button and a window that lists all available columns pops up. The user can check/uncheck the columns and press OK. Any column that was unchecked would be removed and any column that was checked would be displayed. These settings would then be saved for the next time the user opened the program.

I can use the removeColumn method to remove columns that the user unchecks, but I'm wondering how to handle the case when a user checks a previously unchecked column.
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: Adding columns to grid widget

Post by Scott Klement »

What I would do is send the screen back to the RPG program -- then have the RPG re-display the screen. This will reset it back to all columns being shown. Then, you can re-remove the unwanted ones.
ndeppe
New User
Posts: 14
Joined: Fri Dec 05, 2014 1:17 pm
First Name: Nick
Last Name: Deppe
Company Name: Victaulic
Phone: 6109233257
Address 1: 4901 Kesslersville Road
City: Easton
State / Province: Pennsylvania
Zip / Postal Code: 18040
Country: United States
Contact:

Re: Adding columns to grid widget

Post by ndeppe »

That makes sense. I'll give it a try. Thanks, Scott!
SeanTyree
Profound User
Posts: 76
Joined: Fri Jan 11, 2013 6:11 pm
First Name: Sean
Last Name: Tyree
Company Name: US HealthWorks
State / Province: California
Zip / Postal Code: 91355
Country: United States
Contact:

Re: Adding columns to grid widget

Post by SeanTyree »

Another option would be instead of removing the columns, make them 0 width. This could even possibly be stored through the persist state property.

Sean
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: Adding columns to grid widget

Post by Scott Klement »

Let us know which way works out the best for you. I haven't done much experimenting with this stuff, so it'll be good to know what customers find works the best.
ndeppe
New User
Posts: 14
Joined: Fri Dec 05, 2014 1:17 pm
First Name: Nick
Last Name: Deppe
Company Name: Victaulic
Phone: 6109233257
Address 1: 4901 Kesslersville Road
City: Easton
State / Province: Pennsylvania
Zip / Postal Code: 18040
Country: United States
Contact:

Re: Adding columns to grid widget

Post by ndeppe »

I haven't gotten a chance to play around with it too much as other priorities have come up. I did test out the removeColumn method but ran into a snag. The problem is I'm allowing the users to rearrange columns (moveable columns property on the grid), so the column can be in any position. The removeColumn method removes column by its index at runtime and not the index at design time. I think the way I would have to get around this is by using some Javascript magic and determine the column positions at runtime by going through each header element and checking the header text. I can then map the header text to column position in order to determine which columns to remove. That seems like a clunky way of doing it, but I can't think of a way around it.

This sounds like a cool enhancement request for PUI. It would be nice if this functionality was built in. For instance, grids can have a property to allow users to select columns (much like the properties to allow users to resize columns and reposition columns). The users would be able to right-click on the header and choose "Select Columns..." (much like the export to CSV functionality). The users would then be able to select the columns to display. This would be "persistent" like column positions and widths. Just a thought. Maybe I'll submit a request for this for the future.
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: Adding columns to grid widget

Post by Scott Klement »

The best way to submit a feature request is to e-mail it to support@profoundlogic.com
Marcellus
New User
Posts: 2
Joined: Tue Feb 06, 2024 2:34 am
First Name: Marcellus
Last Name: Lewis
Company Name: Magic 8
Country: India
Contact:

Re: Adding columns to grid widget

Post by Marcellus »

ndeppe wrote: Fri Dec 05, 2014 2:03 pm I'm working on a program in Profound UI in which we want the users to be able to show/hide columns in a grid. They would choose which columns they want to see, and this should be saved for the next time the user opens the program. I'm having a hard time figuring out how to implement this. In looking at the Javascript API, I found there is a method removeColumn which removes a column from a grid, but I can't find anything to add a column. I could also implement this by adding all available columns to the grid, but then hiding the columns the user doesn't want to see instead of completely removing it. I would then need to be able to make a column visible if the user decides he/she wants to see it.

Any thoughts on this?
To implement dynamic column visibility in Profound UI, preload all available columns and then selectively hide or expose them based on user preferences. Using methods to change column visibility rather than adding/removing columns dynamically can make the implementation process easier. Further investigation of the Javascript API, or requesting assistance from Profound UI resources, may yield additional insights.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest