Quantcast
Channel: SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 789

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

$
0
0

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);

  retMethList.setModel(oModel);

  params = ",C" + ","

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

  + "";

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

  retMethList.bindItems("/getGlobalTaskList",itemTemplate,null,[filter]);

  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

  .getIconURI("sys-cancel"),

  press : function() {

  this.getParent().close();

  }

  }),

  rightButton : new sap.m.Button({

  text : "SAVE",

  type : sap.m.ButtonType.Accept,

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

  press : function() {

  this.getParent().close();

  }

  }),

  afterClose : [ function(oEvent) {

  var control = oEvent.getSource();

  }, this ]

  }).open();

 

 

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


Viewing all articles
Browse latest Browse all 789

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>