Hi...
can someone give me a hint please, how I could use next/link in a menubar item to switch a page? The window.location works but it will always reload the complete frame and a <Link href='/machines' /> would be much better.
{
label: 'Machines',
icon: 'pi pi-desktop',
command: () => { window.location.href = "/machines"; }
}
BTW: Is it possible to add a "rendered" property like in primefaces?
Best regards,
Mic
Menubar item with next/link
Hi...
I found a solution for my problem. The "next/link" is not needed, I simply use "next/router" instead and the complete page is not reloading anymore:
import Router from 'next/router'
...
const items = [
...
{
label: 'Machines',
icon: 'pi pi-desktop',
command: () => { Router.push("/machines"); },
}
I found a solution for my problem. The "next/link" is not needed, I simply use "next/router" instead and the complete page is not reloading anymore:
import Router from 'next/router'
...
const items = [
...
{
label: 'Machines',
icon: 'pi pi-desktop',
command: () => { Router.push("/machines"); },
}
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Hi,
Thanks a lot for the update! Maybe, a render method can be added to Menuitem API to return JSX element. Good feedback!
Best Regards,
Thanks a lot for the update! Maybe, a render method can be added to Menuitem API to return JSX element. Good feedback!
Best Regards,
Github Profile: https://github.com/mertsincan
-
- Information
-
Who is online
Users browsing this forum: No registered users and 2 guests