MasterDetail and Ajax History

Community Driven Extensions Project
Post Reply
darkbauer
Posts: 10
Joined: 19 Nov 2014, 22:09

28 Nov 2014, 15:00

Hello Community,

I'm discovering the pe:masterdetail component, a great one for many of my app's screens.

I wonder if it was possible for this component to dynamically change the browser URL when clicking on a link and changing of level.

Example :

I am on

Code: Select all

http://localhost/myApp/myView.jsf
and I see, with masterDetail a list of countries.

When I click on a country, the masterdetail component refresh and show me the list of cities of the country.

So, for better integration with browser, I would like that, when I click on the country, the URL of my app dynamically change for something like

Code: Select all

http://localhost/myApp/myView.jsf?country=2
.

Is there a way to do that with the component ?

The only way I see for now is to use JS with something like

Code: Select all

window.history.pushState('', '', '/myApp/myView.jsf?country=2)
but that is not very beautiful...

Thanks in advance for your answer !
JSF 2.2 / Mojara 2.2.8 / WildFly 9.0.1
Primefaces 5.3 / PE 4.0.0
Java 1.8
JPA 2.1

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

01 Dec 2014, 20:51

I think it is beautiful enough...

Adding this in a generic way to PF(E) components would be not easy I think, regardles of how nice it would be to get it added,

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

09 Dec 2014, 15:19

MasterDetail is an ajaxified component and sends POST requests when navigating between levels. There is no clean solution for what you need. JS part of your code is nice, but you have to implement f:viewAction as well - for GET requests and navigation to the desired level on GET.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests