Skip to Content

Extending My Inbox - custom task. Navigation from list to detail doesnt work on mobile.

Hello everyone,

I tried to enhance My Inbox standard Fiori application. I followed My Inbox Extensibility Cookbook to provide specific task type (page 63). I successfully added new screen for new task type and populated with data from backend. Problem is that navigation from S2 (List view) to S3 (Detail view) works on Desktop and doesnt work on mobile. When I open application on mobile first view what I see is S2(List) not S3(Detail). When I tap on List item on mobile I get following error "Can not navigate to route with name null because the route does not exist" in javascript debugger.

The error starts in extended S2.controller. I copied code from cookbook. Here is my code from S2.controller:

sap.ui.controller("cross.fnd.fiori.inbox.CA_FIORI_INBOXExtension.view.S2", {
	onInit: function() {
		var that = this;
		// Read the configuration file for the detail page routes
		//	var sUrl = jQuery.sap.getModulePath("cross.fnd.fiori.CA_FIORI_INBOXExtension") + "/TaskeExtensionMappingConfig.json";
		var sUrl = "/sap/bc/ui5_ui5/sap/z_inbox_ext/TaskeExtensionMappingConfig.json";
		that.oDetailRouteConfig = jQuery.sap.sjax({
			url: sUrl,
			dataType: "json"
		}).data || {};
	},
	getDetailRouteName: function(oEvent) {
		if (!this.oDetailRouteConfig) {
			return "detail";
		}
		var oItem = this.getList().getSelectedItem();
		if (!oItem) {
			return null;
		}
		var oItemData = oItem.getBindingContext().getModel().getData(oItem.getBindingContext().getPath());
		var sDetailRouteName = this.oDetailRouteConfig[oItemData.TaskDefinitionID];
		if (sDetailRouteName) {
			return sDetailRouteName;
		} else {
			return "detail";
		}
	}
});

In desktop when I open application from FLP function getDetailRouteName is called 3 times and the last time the function in row var oItem = this.getList().getSelectedItem(); provide selected item and navigate to detail. On Mobile this function is executed only once when application is loaded, list view is firstly opened (not detail view) and when I try to navigate variable oItem is always null and cant get selected item despite this.getList() is loaded. Where could be possible problem ?

Thanks for any advice. If you need more information let me know I will provide.

Martin

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jul 03 at 08:07 AM

    Hi Martin,
    I was struggling the same issue and found a solution to this. You need to refactor the method 'applySearchPattern' from S2.Controller.js

    applySearchPattern: function (sFilterPattern) {
    	var iCount = sap.ca.scfld.md.controller.ScfldMasterController.prototype.applySearchPattern.call(this, sFilterPattern);
    	var sKey = (iCount > 0 || sFilterPattern == "") ? "NO_ITEMS_AVAILABLE" : "NO_MATCHING_ITEMS";
    	var sNoDataText = this.oApplicationFacade.getUiLibResourceModel().getText(sKey);
    
    
    	this.getList().setNoDataText(sNoDataText);
    	this.searchListFlag = 0;
    	if (this.isMultiSelectActive()) {
    		return iCount;
    	}
    	if (!sap.ui.Device.system.phone) {
    		if (iCount === 0) { // Task list Search FIX       
    			this.oRouter.navTo("empty", null, true);
    			this.getList().removeSelections(true);
    			if (this.oDataManager && this.oDataManager.bOutbox) {
    				cross.fnd.fiori.inbox.Conversions.setShellTitleToOutbox(this.getOwnerComponent(), "cross.fnd.fiori.inbox.view.S2");
    			}
    		} else {
    /** THIS IS THE FIX */
    			var sDetailRouteName = this.getDetailRouteName();
    			this.oRouter.navTo(sDetailRouteName, this.searchListFirstItem, true);
    		}
    	}
    	return iCount;
    },
    
    
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.