Search code examples
javascriptsapui5master-detail

SAP UI5 Master Detail Application


I have made one Master Detail application in sapui5. The problem is when i click on the checkbox the data is displayed on the detail page but when i deselect the check box the data is not changing in the detail page.

Here is my View code:

<List id="fruits" items="{/fruits}" mode="MultiSelect" 
                growing="true" growingThreshold="20" 
             selectionChange="onItemPress" updateFinished="attachUpdateFinished" >
                <!--<DisplayListItem label="{name}" value="{benefit}"></DisplayListItem>-->
                <ObjectListItem intro="{Po_No}" title="{name}" number="{Po_Status}" >
                
                <attributes>
                    <ObjectAttribute text="{type}" title="Category"></ObjectAttribute>
                </attributes>
                </ObjectListItem>
            </List>
            <ObjectHeader id="objid" title="{Po_No}"/>

And here is my Controller code:

onItemPress:function(oEvent){
            
             var oItem = oEvent.getParameter("listItem");
             var sPath = oItem.getBindingContext().getObject();
             
             var oRouter = sap.ui.core.UIComponent.getRouterFor(this); 
             oRouter.navTo("DetailPage",{
                Po_No : sPath.Po_No
             });
             
        },

[As you can see in image that i have deselected the 102 still it shows the data of 102, I want that there should be the data of item which is selected]


Solution

  • If you use mode="SingleSelectMaster" as property on your list, your app should work as expected. See https://sapui5.hana.ondemand.com/#/api/sap.m.ListMode for full list of available list modes.