This is a standard Vision table. I would like to allow users to select what columns they would like to see. By default I would like to have a handful, but if they need more information, they could select a few more.
Is this possible?
Side question: Is there multi-keyword search functionality in the forum search bar? As in, I want to search for threads that contain all the words: one, two, three. I tried using the & between words but not sure that worked.
Yes, but you will need to do it by creating a new dataset for Column Attributes Data then set the columns you want shown to not hidden, and hide the rest. Since datasets are immutable you'll need to write your new dataset to the Column Attributes Data property.
Try this example, I created a custom prop on the table as a dataset and a 2nd table where you can edit the column visibility and then send it to the original table. TableExample.zip (20.2 KB)
Edit:
First export had way more rows that it needed.
So the dataset for the custom property comes from a table in the database, or did you create a second Vision table (hidden)?
Sorry, I do not recognize the window you show and what it is attached to.
Then, would I need to have all the column headings in the (hidden) table for the columnAttributesData to work correctly? That doesn't seem right. So, you got the value and quality from where?
There is no database, the table on the left just has some random data for testing. The custom property is just a copy of the table's columnAttributesData dataset. The right table's data property is bound to the custom property and instead of showing all 30 columns, I hid all but the two shown.
Left table is using test data, has a custom property called ds, but this table has no data in the Column Attributes Data property. I attempted to add the displayed column names in the Column Attributes Data, but got an error:
IllegalArgumentException: No such property 'Col 1' on type 'ColumnAttributes'
So I used a named query, but still no attribute data. I just realized I am looking for the wrong information for the attributes... I need something like name, data type, etc. But, how do I get those attributes?
Ok, so I copied and pasted the attributes into the custom prop: ds, bound Right table's data to Left table ds.
Not sure how to hide all the extra columns in the Right table. Ok, I could not "hide" the extra columns but I could delete them in the ds, what a pain!
And how do I make it editable? Doesn't want to let me change the hidden box. No matter how many times I click, it won't work. Edit: I did use preview mode to try and change the hidden check box.
If you double click on the table, or if you right click and select the Table Customizer from the Customizers item in the pop up menu, it will populate the Column Attributes Dataset.
That dataset will have a hidden column, which if selected will hide that column in the table.
You have to set the column attributes of each column that you want to be editable to allow it. Then in the cellEdited event handler, you will need to modify the value of the dataset(s).
Something like this:
#NOTE: this assumes that the right table's data property is bound to the
#left tables columnAttributesData property. The system.db.refresh on the last
#line forces the binding to update, which will insure that the two datasets match.
ds = event.source.parent.getComponent('Left Table').columnAttributesData
ds = system.dataset.setValue(ds,event.row,event.column,event.newValue)
event.source.parent.getComponent('Left Table').columnAttributesData = ds
system.db.refresh(event.source,'data')
But... there is no way to edit the Right table cells? I was hoping to find a way to allow users to select which columns are visible, kind of like a pen in the charts.
So I'm looking at the column attributes for the right table
Trying to allow edits on the column titled hidden. Is this possible? Do I need to add something in the Header attribute?
You need a bidirectional binding from the table showing the columns to the main table's c-a-d property. Then you need to implement the edit handler extension script to update the column data (as a row).