Quantcast
Channel: SCN: Message List - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 8124

Filter on a table column - with a dropdown and dynamic list elements

$
0
0

Hi,

 

In our current project, we are using SAP UI5 libraries version 1.22.3

 

To explain the scenario, we have table element, which has a dropdown column. The table is bound to a model, so the model is available to all the controls that are present in the table.

 

The list elements are added to the combobox dynamically based on the value that is bound to the column(which come from the model).

 

When we use the standard filters of the column, it behaves inconsistently. e.g the values will vanish upon removal of filter, the filter will not happen beacuse it wont treat as a text etc.

 

If we replace the dropdown with pop-up help, it treats the element as a text field and the filter works.

 

As i understand from the forum, this is problem has been in older versions of UI5:

Combo Box in a DataTable

 

Question 1: As per link, the older version of UI5 has an some bugs in filter. Possible solution: upgrade the UI5 version and this should resolve the issue?

Question 2: The comobox is bound to a 'value' field 'STAT_TEXT' in the model and the Filter is based on the combobox 'key' 'STAT_CHG_TXT' from the model. Will the column filter work when it is bound to one 'value' of he model and the filter is expected to happen on the 'key' value?

 

var cb = new sap.ui.commons.ComboBox({  change : function() {  isModified = true;  sap.ui.getCore().getModel().setProperty("/globalModelData/isMod",true);  },  enabled : "{/modelData/Modificable}"  }).bindProperty(  "value",  "STAT_TEXT",  function(STAT_TEXT) {  if (STAT_TEXT == "Not") {  this.removeAllItems();  this.addItem(new sap.ui.core.ListItem(  {  text : "Not",  key : "Not"  }));  this.addItem(new sap.ui.core.ListItem(  {  text : "In",  key : "In"  }));  return STAT_TEXT;  } else if (STAT_TEXT == "In") {  this.removeAllItems();  this.addItem(new sap.ui.core.ListItem(  {  text : "In",  key : "In"  }));  this.addItem(new sap.ui.core.ListItem(  {  text : "Out",  key : "Out"  }));  this.addItem(new sap.ui.core.ListItem(  {  text : "InOut",  key : "InOut"  }));  return STAT_TEXT;  } else if (STAT_TEXT == "Out") {  this.removeAllItems();  this.addItem(new sap.ui.core.ListItem(  {  text : "Out",  key : "Out"  }));  return STAT_TEXT;  } else if (STAT_TEXT == "InOut") {  this.removeAllItems();  this.addItem(new sap.ui.core.ListItem(  {  text : "InOut",  key : "InOut"  }));  return STAT_TEXT;  } else {  this.removeAllItems();  return "No Status";  }  }).bindProperty("selectedKey","STAT_CHG_TEXT");
oTableOtherDev.addColumn(new sap.ui.table.Column({  label : new sap.ui.commons.Label({  text : "STAT*(FILTER)"  }),  template : cb,  sortProperty : "STAT_CHG_TEXT",  filterProperty : "STAT_CHG_TEXT",  width : "100px"  }));

Viewing all articles
Browse latest Browse all 8124

Trending Articles



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