[Table] Add Visible Attribute to column Definition or NotVisible to Table component #17328
Unanswered
alwaqfi
asked this question in
Ideas / Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
At first, let me say thank you for this amazing and well build/rounded framework.
This is more of a request/discussion as it was mentioned in this Issue however it was closed for inactivity. I tried to see if there was a discussion started but couldn't find any (or my search words have betrayed me).
Use case:
In some cases we want to hide some columns based on certain criteria like permissions.
These columns we want to hide can be in different places in the table and we want to maintain this order. So, in this case it will be hard to re-add them to the array while maintaining the order.
With the current implementation
columns
property will contain all columns, andvisible-columns
will contain only visible columns.Proposed solutions:
Solution 1: Add a new option to
visible
attribute toQTable
Columns
, and this property accept: Boolean | Undefiened (or just boolean and true is the default value)Solution 2: Add a new property to
QTable
called for examplehidden-columns
where it gets higher priority overvisible-columns
and will contain column names we want to hide.QTable API:
Work around solutions:
Possible solution 1:
By having
columns
as computed property where it returns only visible columns.Possible solution 2:
By having
visible-columns
as computed field that is a clone ofcolumns
array and then remove columns we want to hide.Solution 1 feels more natural than Solution 2 but both solution is not clean in my view as they require more logic to hide columns (remove or add them from/to the list).
I wonder if it is more logical to have one of the proposed solutions? I lean towards
Proposed solution 1
since it can be done on the flight similar toformat
.Thank you so much,
Asif
Beta Was this translation helpful? Give feedback.
All reactions