XPages Navigation - Updating Panels with Link onclick Events - xpages

I'm trying to deploy "Building a Configurable and Extensible XPages Navigation" I found in THE VIEW (I'm a subscriber):
http://www.eview.com/eview/volr6.nsf/articleURL/2012-09-building-a-configurable-and-extensible-xpages-navigation.
My design is very basic and traditional: two panels. In the left panel a Custom Control with the navigation as links. In the right panel an "Include Page" control for displaying XPages as a result of onclick events of the links in the left panel.
Problem: can't get the the right panel to update.
Have tried, in vain: passing sessionScope parameter with SSJS, partial updates, postScript with partialRefreshGet.
MY CODE:
My "almost" working version - needs a manual refresh/reload to actually display the desired XPage in the right panel's "Include Page" control.
Link onclick: sessionScope.showPage = "xspByYear.xsp"; AND Partial Update of right panel.
Right panel's "Include Page" - pageName AND onClientLoad (with Home as default):
var tmp = sessionScope.showPage;
if (tmp == null){
"xspHome.xsp";
} else {
tmp;
}
Comment: All Properties/pageName had an "$" added, not allowed to change to "#": "... cannot be a run time binding."

You can pass the "Include Page" control to a panel. Set an id to the panel and refresh the panel in the onclick event of the links (Partial Update).
<xp:panel id="panelToUpdate">
<xp:include pageName="/MyXPage.xsp" id="include1"></xp:include>
</xp:panel>

Related

Liferay 7.3: How to make menu items in a theme controlled by admin

I have a liferay theme for version 7.3. I am facing one problem in the theme's menu.
Now menu has some static items. How can I change (add / remove) items dynamically by admin account?
The menu is added in /src/templates/portal_normal.ftl as
<#include "${full_templates_path}/menu-bar.ftl" />
this file has static html data.
Now how can I make it dynamic so that admin can change the menu items?
Make the menu as a web content, and drag it to the theme? Not makes sense because menu is the part of the theme.
Or any other way of picking the menu items, looping the items in .ftl and display it?
The times of scripting navigation and menus in the theme are over, and I'd rather recommend to embed a portlet in your theme that does the job. That might be a stock NavigationMenu portlet (see how Liferay's default "classic theme" does this with NavigationMenu or the SearchBar), or a custom one, which generates exactly what you'd like.
Reason: It's a lot simpler to redeploy a new portlet and generate/test appropriate HTML markup generation in a portlet than it is to implement proper error handling in a theme's freemarker script.
The solution can be if you want to add your data in navigation menu in themes, go into the navigation menus inside site builder in menu and create a new menu by clicking + button on top right and name the menu. Then go into the pages inside site builder inside menu. There will be a + sign on public pages. Click that and add a page that you want to list. If you want to create a submenu then on the page that is created, create a subpage by clicking there + sign. The page will be child and will be shown as a sub menu in theme.

Add Nav buttons on left hand side of Navigation bar

I have a Xamarin page with a Navigation bar at the top.
I keep changing the views on the page with some button clicks, but the page remains the same.
What I need is, when I load a new view (say View A) on this page, I want to add a Back button on the top Nav bar of the page.
I saw some forums where they are using Custom page renderers to add Back button.
But here, the page remains the same. Only the view changes. So, I guess I need to use the custom view renderer to add the Navigation button.
How can I achieve this, as NavigationController which I need to add a Nav button is present in Page renderers, not View renderers.
I need some help.
Thanks
UIBarButtonItem customButton = new UIBarButtonItem(
UIImage.FromFile("Image/image.png"),
UIBarButtonItemStyle.Plain,
(sender, e) =>{
//InitView
});
NavigationItem.LeftBarButtonItem = customButton;
this.NavigationItem.LeftBarButtonItem.TintColor = UIColor.Orange;

Specify which panned tab to be opened in ADF

Is there a way to specify which tabbed panel to be opened in an ADF project. For example, we have a view page with tabbed panel. We have a button which leads to a new task flow and when we return from it we should be on a particular panel box in the tabbed panel.
Any suggestions? Thank you!
Firstly , always mention your Jdev version.
You can create a binding for panel Tabbed component like
RichPanelTabbed rpt = getMyPanelTabbedBinding();
Next , you would have to find which ShowDetailItem to show and then you can call setDisclosed() on RichShowDetailItem's object like below :
List<UiComponent> myChildList = richPanelTabbed.getChildren();
RichShowDetailItem sdi = myChildList.get(0);
sdi.setDisclosed(true);
From this you can set disclosed tab as per your wish.
For more, search with "open panel tab programatically in ADF".
-Sid

JSF How to display the Navigation confirm popup before forwarding to other page

I'm using Primfaces Layout component in my pages and I'm not using Redirection in navigation when user clicks on the Menu links.
i.e.,I'm NOT using faces-redirect?true and URL doesn't change when user navigates.
I want to display a Confirmation Dialog before user navigates away from current view, like
“Are you sure you want to navigate away from this page?”
So once user clicks on the OK then it should forward to other page or else it should stay in same page if user clicks on CANCEL.
One more constraint is I want this functionality for only few selected pages not all of them.
What is the best approach to deal with this problem?
Primefaces Version: 3.5
JSF Version: 2.1.13
All my ManagedBeans are in #ViewScoped
If you want to try solving this problem from javascript-side, either go with
window.onbeforeunload = function(e) {
return 'Dialog text here.';
};
and see the dialog independent from the link being clicked (see https://stackoverflow.com/a/12132076/1269441). or try adding
onclick="if (!confirm('Your dialog-text here')) {return false;}"
to a selection of links you would like to have the dialog shown.

JSF Primefaces:redirect to specific page on p:tab click

I would like to utilize p:tabView for horizontal site menu.
When tab is clicked,that user should be redirected in non-ajax style to the specific page.
Is it possible to inject to each tab (e.g. inside p:tab tag) href link ?
Or there is already some alternative to it?
You could put the p:tabView in a template and set the activeIndex property according to the view ID of the current page. It's an ugly hack, but certainly do-able. I did something similar, using a p:menu on the left for navigation in the control panel section of my site.
Primefaces 3.4 now has a p:tabMenu component that may be of use.
You will have to manage the active tab manually since this is an undeveloped feature.

Resources