Perspective Table: save display customization

A customer of mine would like to save a Perspective Table aspect after playing with column widths and order. I cannot seem to find any event associated with column width or column order change. Is it possible to go after my customer request?

Thanks in advance, regards

The most likely best you can do is to offer a save button or icon (with an appropriate tooltip) and run a script to run through the columns and extract the width properties. Then save them to a database with the username and view / table name. It can only work with a logged in user.

On initial loading of the view a script would retrieve the values and overwrite the Designer defaults.

It's a bit of bother.

Yeah, you can save the table's column property to the database for a particular user. There is a property dragOrderable that allows the user to order columns, in my experience, this only works when the columns are defined in the columns property.

The important thing is when you reorder in the session, that property will also get reordered. That takes care of your column orders.

Within each object that's in the columns list, there are strictWidth (boolean) and width (int) properties. As far as I can tell, the designer doesn't update any values when I resize the columns, so I don't think you'll be able to save those, unfortunately. What you can do is to create an additional widget on your view that has the table with a column selector and a width numeric entry field that you can then enable the strictWidth property on the column the user selects, and put their entered width into the appropriate column's width. The width property is in pixels and you don't specify the units, as far as I remember.

Then, you'd proceed just like before, save the columns object to the database (and, of course, read it whenever the view is opened).

1 Like

That's my experience too, even if I did not test it in runtime but just looking at the columns prop in the Designer - I'll have to test if @Transistor is right, as far as runtime behavior is concerned.
Thanks

Try adding a label to the view and bind it to one of the column width properties to see if it changes as the column is adjusted. The more I think about it I think that it won't. The table component won't write the values back to the gateway so there will be no new information to save.

Hmm. Designer doesn't even know about it. Gateway won't.

I think an alternative to this (depending on how important of a feature this is for your customer) is to have a Configure button that will open a popup, dock or other view somewhere, where the user can select a column (in a dropdown) and enter a width, which you can then use to write back to the columns property on the table. Then, after the user reordered the columns and set widths, you can save the configuration to the database (meaning saving the columns JSON to the database).

Let me know if that makes sense, I think this is how I would approach the problem if this was a must-have feature.

1 Like

Thanks all for your suggestion. I was already going the way of a "configuration editor", where the customer can set the columns width and order, but the customer told me that it's not particularly user friendly - and he is right indeed. Hence I asked in the forum for further solutions.

My last idea - if there are different groups of users that view the same table, another thing you could try that could be somewhat more dynamic would be to hide certain columns (and thus provide the rest of the visible columns more width) depending on the user group.

For example, if you have a Sales Order table, you might have Salespeople, Production Schedulers, and people in Shipping all looking at the same table but really needing a certain subset of the data. IF your user sources were set up by department AND <a_whole_bunch_of_prerequisites_here> then you might be able to use the user group to dynamically generate the columns object for the Table dynamically with some of the column's visibility set to False.

I'm grasping at straws, though... I'm assuming a bunch of things about your scenario to maybe spark another idea that you could implement?

If you find a way to do this, please let us know - I would likely implement something like this in the future.