Saving the current table configuration into a User View
To save a User View:- On your table, apply any combination of filters, toggled columns, sort order, grouping, etc.
- After customizing your table, click the
+in the top right corner of the table. - Choose a name, icon, and color for the view.
- Choose if you want the view to be added to your favorite views, made public for other users, or be a global favorite.
- Save the view
- current filters,
- table search query,
- column search queries (if enabled)
- column sort order
- toggled columns
- column order
- grouping
User View configurations
Advanced Tables offers multiple ways to customize User Views. Unless specified otherwise, these options can be configured directly on theAdvancedTablesPlugin object inside your PanelProvider:
Disable User Views
User Views are enabled by default. However, if you are not going to use User Views, you should disable them to prevent unnecessary database queries:Configuring the User View model
TheUserView model is responsable for storing all the configuration settings for each User View. If you need to extend this class, you may pass your custom class to userView():
Configuring the Managed User View class
TheManagedUserView model is responsable for managing the visibility and sort order between a User and a UserView. If you need to extend this class, you may pass your custom class to managedUserView():
Disabling the icon picker
You may disable the icon picker in the Save View/Edit View slideOver by passingfalse to the quickSaveIconSelect() method:
Excluding solid or outline icons
By default the icon picker loads all of heroicons solid and outline icons. You may exclude either solid or outline icons by passing false to either thequickSaveIncludeOutlineIcons() or quickSaveIncludeSolidIcons() methods:
Important: Since icons are cached, after updating you will need to clear your cache to see the change with php artisan cache:clear.
Configuring the color picker colors (New)
By default, the color picker will include Filament’s default colors,primary, success, info, warning, danger, gray. To configure the available colors, pass an array of colors to ->quickSaveColors():
Disabling the color picker
You may disable the color picker in the Save View/Edit View slideOver by passingfalse to the ->quickSaveColorPicker() method:
Disabling making a User View favorite
By default, when creating/editing a view, users can favorite their views by toggling onAdd to favorites. Favorite views are added to the Favorites Bar and appear above the table. You may disable the ability to make a User View favorite by passing false to the ->quickSaveMakeFavorite() method:
Disabling making a User View public
By default, when creating/editing views, users can share their views with other users by toggling onmake public. Public views will appear in other user’s View Manager where they can then be added to their favorites if they wish.
Advanced Tables also has an approval system so admins can approve public views before they are visible to other users.
You may disable the ability to make a User View public using the ->quickSaveMakePublic() method:
Enabling making a User View a global favorite
Making a User View a global favorite automatically adds it to every user’s Favorites Bar. As this is an action usually reserved for admin users, this functionality is turned off by default. You may enable the ability to make a User View a global public using the->quickSaveMakeGlobalFavorite() method:
Disabling management of global favorite views
As previously mentioned, when an admin or user creates a global favorite view, that view is added to all user’s Favorites Bar. By default, these global views can then be managed (ie. sort and favorite/un-favorite) independently by each user. If you need to disable management of global User View you may do so by passingfalse to the ->globalUserViewsManageable() method:
globalUserViewsManageable, global favorites will be not be able to be sorted nor removed from a user’s Favorites Bar.
Configuring new global user view’s sort position
When global favorite management is disabled, all global favorites are added before any User Views that a user has favorited. However, when global view management is enabled, a user is then free to reorder them, placing global views before, after, or in between their own user-favorited views. Now, when a new global view is created by an admin, a decision needs to be made as to whether this new global view should be placedbefore or after the user’s previously ordered favorite views. By default new global views are positioned before a user’s favorited views, however this can be configured using the newGlobalUserViewSortPosition() method:
Showing/hiding helper text
When creating/editing User Views you may show/hide helper text to help guide your end-users during the process. By default, helper text is only displayed for the Favorite, Public, and Global Favorite toggles.Approving public and global favorite User Views
Advanced Tables includes a simple approval mechanism to allow admins to approve/reject public and global favorites before they are made available to other users. Advanced Tables uses Filament’s enum to define theStatus constants:
initialStatus() to either Status::Approved, Status::Pending, or Status::Rejected. By default, each User View has an initial status of Status::Pending:
minimumStatusForDisplay() to either Status::Approved, Status::Pending, or Status::Rejected. By default, the minimal status is Status::Pending:
minimumStatusForDisplay(), it will be displayed to other users.
Advanced Tables default setting of Pending for both Status and minimumStatusForDisplay means that all public and global User Views will automatically be displayed to other users, effectively bypassing the approval system. Changes only need to be made if you would like to enable the approval system.
To update the status of a User View, admin should use the User Views Resource.
Of course, Laravel’s Observers can be implemented on the UserView model to further expand the approval system with database or email notifications.
Persisting the active User View to Session
Persisting the active User View to the session allows a user to navigate away from the table and then return to the table with the same view selected. You may enable this by using the->persistActiveViewInSession() method: