Yes I got that too.
// ERXModernNavigationMenu Support
public NSKeyValueCoding navigationContext() {
NSKeyValueCoding context = (NSKeyValueCoding)session().objectForKey("navigationContext");
if (context().page() instanceof D2WPage) {
context = ((D2WPage)context().page()).d2wContext();
}
if(context == null) {
context = new NSMutableDictionary<Object, String>();
session().setObjectForKey(context, "navigationContext");
}
ERXNavigationState state = ERXNavigationManager.manager().navigationStateForSession(session());
return context;
}
didn't work for me. Only in D2W App, but not in Hybrid App's. The design above won't work with second or third Layer.
I changed it like below, and now it works great in Hybrid App's too.
//********************************************************************
// Navigation
//********************************************************************
/**
* Rule : Set "navigationState" to update ERXNavigationState
*/
public NSKeyValueCoding navigationContext() {
NSKeyValueCoding context = (NSKeyValueCoding)session().objectForKey("navigationContext");
if (context().page() instanceof D2WPage) {
/* D2W Page */
return ((D2WPage)context().page()).d2wContext();
} else if(context instanceof NSMutableDictionary<?,?> || context instanceof NSDictionary<?,?>) {
/* not an D2WContext, but Normal Page NSDictionary */
} else if(context == null) {
context = new NSMutableDictionary<Object, String>();
}
ERXNavigationState state = ERXNavigationManager.manager().navigationStateForSession(session());
NSMutableDictionary<String,String> mdic = new NSMutableDictionary<String,String>(1);
mdic.setObjectForKey(state.stateAsString(), "navigationState");
context = mdic;
session().setObjectForKey(context, "navigationContext");
return context;
}
Hope this help, and maybe that has to be fixed in the Demo as well.