Skip to content

Provide example of content loaded via Ajax instead of page redirect #185

Open

Description

@tulkas85

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 ?

  • AdminFaces version: 4.0.0
  • PrimeFaces version: 7.0
  • JSF implementation:

Activity

  1. rmpestano commented on Jun 28, 2019

    @rmpestano
    Contributor

    Hi, can you take a screenshot to make sure we're talking about the same thing? Thanks

  2. tulkas85 commented on Jun 28, 2019

    @tulkas85
    Author

    I hope is clear in this example:

    adminfaces_question

    I don't want this menu refresh on click.

  3. rmpestano commented on Jun 28, 2019

    @rmpestano
    Contributor

    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

  4. tulkas85 commented on Jun 28, 2019

    @tulkas85
    Author

    I thought only "content" div change when new page is selected. There is a way in admin-template to change only "content" div ?

  5. rmpestano commented on Jun 28, 2019

    @rmpestano
    Contributor

    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.

  6. tulkas85 commented on Jun 28, 2019

    @tulkas85
    Author

    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/

  7. rmpestano commented on Jun 28, 2019

    @rmpestano
    Contributor

    again, the template doesn't enforce it, it just turns out that we don't have examples where the content is loaded via ajax.

  8. tulkas85 commented on Jun 28, 2019

    @tulkas85
    Author

    ok, thank you.
    Maybe in future you can post some examples or an "admin-starter-ajax" project that works like AdminLTE using ajax ?

  9. changed the title [-]sidebar-menu tree collapse on click[/-] [+]Provide example of content loaded via Ajax instead of page redirect[/+] on Jun 28, 2019
  10. rmpestano commented on Jun 28, 2019

    @rmpestano
    Contributor

    👍

  11. tulkas85 commented on Jun 28, 2019

    @tulkas85
    Author

    thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions