Skip to Content
Former Member
Aug 26, 2015 at 05:50 AM

How to filter data and show it in master details view


My Data

var myData= {


I want to create a SplitApp(Master-Details page). I have created the Master page as a List of User Name from the User dataset. The list should contain the firstname.

var oList = new sap.m.List({
mode: sap.m.ListMode.SingleSelect,
select: function(){
var oItemTemplate = new sap.m.StandardListItem({
id: "sList",title:"{firstname}"});
oList.bindAggregation("items","/user",oItemTemplate );
return new sap.m.Page({
title: "Claims",
content: [oList]

Now in details page I want to show the expenses made by that user(when i select a specific user from master view) in a table.

Now my question is how to filter data and use it for the Details view. Example: If I select User "X" from Master view list, I should get id 1 from the "user" and Expenseno 1,4 and 7 (as they are associated with uid 1) from "expense", finally i will show the expenses of uid 1 in the details view.

Code I am trying

itemSelected: function(){
var app = sap.ui.getCore().byId("appId");
var list = sap.ui.getCore().byId("listId");//will get instance of the list
var sItem = list.getSelectedItem();//should know which item we selected

//*** How To filter ***//

//var Model = new sap.ui.model.json.JSONModel(oitem); // will use it for details
//sap.ui.getCore().setModel(Model,'item');// view(oitem should contain the filtered data)