->hidden() column attribute
Closed this issue · 6 comments
One feature that would push a great package "over the top" in my opinion would be the addition of hidden() as a column attribute similar to sortable() and searchable().
For example, Column::make('ID')->searchable()->sortable()->hidden(). This would allow for a column listing to be shown to the user and let them determine what columns are important to see.
Thoughts?
I'm not sure I understand what you're asking for. You could simply have a cookie, or even a user database column for the ones they want to see, and use auth()->user()->columns
in the fields()
declaration or something. I'm still confused with what you're asking tho...
We have a table with 71 columns.
One department uses only 8 of those columns and another department uses only 12 columns.
For those department users, it would be great if they could pop open a modal and uncheck the columns they don't need to see to get their work done. A hidden() attribute would allow this.
So then just set your columns based on the department, no?
if ($department == 'Department 1') {
return [
Column::make()...
];
}
else if ($department == 'Department 2') {
return [
Column::make()...
];
}
That actually was my original thought but there is no component, so there is no mount() method to accept anything outside the model unless I missed the boat.
you don't need to override mount()
, you can do it inside the columns()
method.
and even if you do need to override mount()
, it explains how in the readme:
mount()
This method sets the initial table properties. If you have to override it, be sure to call $this->setTableProperties()
.
Example:
public function mount()
{
$this->setTableProperties();
// my custom code
}
You're right.
Sorry I missed that.
Your package is BRILLIANT!!!