How to change the order of navigation group sub-items

Is it possible to change the order of sub-items of a navigation group? i'd like to move some sub-items position
11 Replies
Full Stack developer
it is possible, why not?
Bruno Pereira
Bruno Pereira3w ago
despite being in a group you can sort the items by defining
protected static ?int $navigationSort = 3; // change to your order
protected static ?int $navigationSort = 3; // change to your order
jamesro
jamesroOP3w ago
@Bruno Pereira i tried that, but its changing the group order not the order of that group sub-item linked to a resource/page
Bruno Pereira
Bruno Pereira3w ago
try defining the order of the group in the panel, like this:
$panel
->navigationGroups([
'Shop', change to correct order
'Blog',
'Settings',
])
$panel
->navigationGroups([
'Shop', change to correct order
'Blog',
'Settings',
])
and keep the sort param in the pages
jamesro
jamesroOP3w ago
oky will try @Bruno Pereira doesn't seems to be working, the ->navigationGroups([ 'Shop', change to correct order 'Blog', 'Settings', ]) works, changes the order, but when i try to change a sub-item order in a group it still seems to be using alphabetic ordering
Bruno Pereira
Bruno Pereira3w ago
can you show your sub-item code?
jamesro
jamesroOP3w ago
i've just added protected static ?int $navigationSort = 1; in my TeamUserResource, which is assigned to Admin group with protected static ?string $navigationGroup = 'Admin'; but the position of TeamUsers still shows last in the group sub-items
Bruno Pereira
Bruno Pereira3w ago
and every sub-item of the group has the $navigationSort defined?
jamesro
jamesroOP3w ago
TeamUserResource itself is a sub-item of the group
protected static ?string $navigationGroup = 'Admin';

protected static ?string $navigationLabel = 'Team Users';

protected static ?string $label = 'Team User';

protected static ?string $pluralLabel = 'Team Users';

protected static ?string $slug = 'teamusers';

protected static ?int $navigationSort = 1;
protected static ?string $navigationGroup = 'Admin';

protected static ?string $navigationLabel = 'Team Users';

protected static ?string $label = 'Team User';

protected static ?string $pluralLabel = 'Team Users';

protected static ?string $slug = 'teamusers';

protected static ?int $navigationSort = 1;
Bruno Pereira
Bruno Pereira3w ago
hmm maybe this way doesnt work, you can try this https://discord.com/channels/883083792112300104/1154445824571474012 way
jamesro
jamesroOP3w ago
my bad seems it works, was just because some of my other resources didnt had all $navigationSort set

Did you find this page helpful?