You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide example of content loaded via Ajax instead of page redirect #185
I'm working on top of Admin-starter-tomcat project.
I'm using "sidebar-menu tree" on the left, but I don't want it collapse when click on submenu link.
Same problem is in admin-showcase demo, If you click Ui Element-> Accordion and then UIElement ->AutoComplete , you can see UiElement close and open again. Maybe all sidemenu is reloaded.
It's possible to leave expanded submenu when click same submenu items ?
Well there is a page reload, that's why it refreshes. This is needed because you're navigating to a different page. If you stay on the same page and reload content via ajax (imitating a SPA), the menu will not refresh
yea but keep in mind that this is not a admin-template thing but how the web works.
You can reload the content div via ajax when you click on menu link instead of redirecting user to a new page but you'll need to take care of other things like the page url, how to bookmark pages, JSF viewScoped beans ( viewScope beans are alive as long the page doesn't change), you'll need to save the state somewhere to know what to render in content div, handle the browser back button and so on, probably there is a dozen of other problems to take care.
So I prefer to keep things simple and just redirect user to a new page which has its own JSF managed bean and it works pretty great.
PS: Some (5) years ago I did that (content reload via ajax) in an old framework I maintained using JSF, you still can see the example here where the pageControl panel is updated via ajax and statelessPersonMBean.beanState decides which pages (find, list, update, friends) will be rendered.
Activity
rmpestano commentedon Jun 28, 2019
Hi, can you take a screenshot to make sure we're talking about the same thing? Thanks
tulkas85 commentedon Jun 28, 2019
I hope is clear in this example:
I don't want this menu refresh on click.
rmpestano commentedon Jun 28, 2019
Well there is a page reload, that's why it refreshes. This is needed because you're navigating to a different page. If you stay on the same page and reload content via ajax (imitating a SPA), the menu will not refresh
tulkas85 commentedon Jun 28, 2019
I thought only "content" div change when new page is selected. There is a way in admin-template to change only "content" div ?
rmpestano commentedon Jun 28, 2019
yea but keep in mind that this is not a admin-template thing but how the web works.
You can reload the content div via ajax when you click on menu link instead of redirecting user to a new page but you'll need to take care of other things like the page url, how to bookmark pages, JSF viewScoped beans ( viewScope beans are alive as long the page doesn't change), you'll need to save the state somewhere to know what to render in content div, handle the browser back button and so on, probably there is a dozen of other problems to take care.
So I prefer to keep things simple and just redirect user to a new page which has its own JSF managed bean and it works pretty great.
PS: Some (5) years ago I did that (content reload via ajax) in an old framework I maintained using JSF, you still can see the example here where the pageControl panel is updated via ajax and
statelessPersonMBean.beanStatedecides which pages (find, list, update, friends) will be rendered.tulkas85 commentedon Jun 28, 2019
I know how works SPA, I thought admin-template works as SPA, like AdminLTE.
Here you can see how AdminLTE left menu works :
https://adminlte.io/themes/AdminLTE/
rmpestano commentedon Jun 28, 2019
again, the template doesn't enforce it, it just turns out that we don't have examples where the content is loaded via ajax.
tulkas85 commentedon Jun 28, 2019
ok, thank you.
Maybe in future you can post some examples or an "admin-starter-ajax" project that works like AdminLTE using ajax ?
[-]sidebar-menu tree collapse on click[/-][+]Provide example of content loaded via Ajax instead of page redirect[/+]rmpestano commentedon Jun 28, 2019
👍
tulkas85 commentedon Jun 28, 2019
thank you