Skip to Content

Bind sap.m.StandardListItem "Selected" Property from odata boolean Result "X"

I was trying to bindItems in a sap.m.List of sap.m.StandardListItem, but was not able to make sap.m.ListMode.MultiSelect selected if one parameter is coming "X". In filter if we use this boolean check then false results will not be shown in output. To show in a Dialog the list with selected StandardListItem, I used bindProperty and it works. Here is my code example:

Code Snippet

var itemTemplate = new sap.m.StandardListItem({

title : "{SrvTaskDesc}", // string


itemTemplate.bindProperty("selected", "IsenbDisInd", function(bValue) {

return bValue == "X" ? true : false;


retMethList = new sap.m.List({

mode : sap.m.ListMode.MultiSelect,


url = location.protocol+"//"+dynamicHost+":"+dynamicPort+"/sap/opu/odata/XXX/XXXXXXX/";

oModel = new sap.ui.model.odata.ODataModel(url, true);


params = ",C" + ","

+ sap.ui.getCore().getModel("userModel").getData().plant + ",,,,"

+ "";

filter = new sap.ui.model.Filter("IAllparam", sap.ui.model.FilterOperator.EQ, params);


new sap.m.Dialog({

title : "Sanjoy Saha", // string

content : retMethList, // sap.ui.core.Control

leftButton : new sap.m.Button({

text : "CANCEL",

type : sap.m.ButtonType.Reject,

icon : sap.ui.core.IconPool


press : function() {




rightButton : new sap.m.Button({

text : "SAVE",

type : sap.m.ButtonType.Accept,

icon : sap.ui.core.IconPool.getIconURI("save"),

press : function() {




afterClose : [ function(oEvent) {

var control = oEvent.getSource();

}, this ]


Here IsenbDisInd is the field which is coming from odata as "X" or "" as output and based on that ListItem is selected or deselected.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jan 16, 2016 at 02:35 PM

    Will this helpful for you?,js,output



    var data = [{

    "title" : "SSE",

    "selected" : "X"



    "title" : "SE",

    "selected" : "Y"


    var model = new sap.ui.model.json.JSONModel(data);



    var itemTemplate = new sap.m.StandardListItem({

    title : "{title}",

    selected : {

    path : "selected",

    formatter : function(oEvent){

    return oEvent=="X" ? true : false;




    var retMethList = new sap.m.List({

    mode : sap.m.ListMode.MultiSelect





    Karthik A

    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.