How to order naviation groups
Hi everyone is there a way i can reorder navigation groups for now if i am using the navigationSort is not working
8 Replies
i find the solution, it is to defined the in the AdminPanelProvider your groups
you can also do it like this in AdminPanelProvider.php if you don't need the functionality from
NavigationGroup::make
🙂
Thanks
Hello.
I've got into the same trouble as the author of the post, however adding the navigastionGroups to AdminPanelProvider does not seem to resolve my navigation groups order and instead they are ordered in an Alphabetical order.
Here is my navigationGroups markup:
However the order is strangely set to:
Employees Management, System Management and Users Management
Any ideas how can I resolve the order as I've been reading and reading documentations and followed several tutorials, however so far the only way to reorder the navigation groups was by using the following suggested code related to translations:
Having used this code DOES ORDER my groups in any way I need them, however it ignores the state of the navigation group and I cannot set it as collapsed(false)
Btw, using the shorter version of ordering (just for the sake of testing):
Did not order the navigation groups as well... Besides I need to be able to define the state of a group (eiter it is collapsible or not)...
in AdminPanelProvider I use
and it shows Z first in the nav
so maybe there is something overriding it, maybe post your entire AdminPanelProvider
@TheRealTeeHill
Yes., that is what I use presently and I confirm it works fine now, however in the format you shared and I use, you cannot define the label, icon, collapsed() and any other properties there are but just the order.
Here is the scenario I am aiming: Have navigation groups A, B, C which all have own icon and A is collapsed, B - not, C - collapsed too.
I noticed that the collapsed state is somehow stored per user ( I guss it is in the session or local) but by default we should be able to define if a navigation group should be "Open" or "Closed"
And yes, I know it is more common to provide the icons in the sub-navigation items, but what if you just want to have icons on the navigation group itself (and the functionality is already provided) ....
@MilenKo are you wanting to use an icon for the nav group and for the nav group sub-items? as I don't think you can do that...?
For the nav group part, I will need to take another look this weekend 👍
@TheRealTeeHill
Obviously the way the Filament is configure I cannot have icons on both and that is sad as many websites have such ui/ux but it is what it is.
My news is to set the order of the navigation groups and have every group with its own icon (only for the group) not for the child items.
Having just the navigation groups in the desired order listed does help to order but does not allow me to change label, set an icon, definitely the colaps state and so forth...
I can define the icon using the code provided in the demo but that does not order them and they appear in A-Z state even if they were placed differently in the panel config
I've moved out by setting a group icon and having sub menu items not having one as it makes more sense for my current project needs. By design filament allows either to have icon on the group but not on the items inside the group, or not to group the items and have an icon for any of the items on their own...
It is what it is, I am not keen on modifying the filament code as I will have to deal with updates later and it will be a hassle, so for me this topic is closed now... 😉 (having other issues to tackle 😉 )