This issue came forth from drilling down the original question: How to set filter in table dropdown based on table row data
Background
I wan
No, it is not currently possible to set Filter value using data binding. However, there is an approved enhancement issue in the OpenUI5 repository labeled "contribution welcome". This means that it is planned to add this functionality, and once added it will be possible to set the Filter value using data binding.
I just went through the code of ClientListBinding, unfortunately the property binding for Filter value is not supported. Please check the source code here.
See function getFilterFunction, the filter value is get from your Filter definition oValue1 and oValue2, it does not parse any DataBinding path to get value from DataModel.
/**
* Provides a JS filter function for the given filter
* @name sap.ui.model.ClientListBinding#getFilterFunction
* @function
*/
ClientListBinding.prototype.getFilterFunction = function(oFilter){
if (oFilter.fnTest) {
return oFilter.fnTest;
}
var oValue1 = this.normalizeFilterValue(oFilter.oValue1),
oValue2 = this.normalizeFilterValue(oFilter.oValue2);
switch (oFilter.sOperator) {
case "EQ":
oFilter.fnTest = function(value) { return value == oValue1; }; break;
case "NE":
oFilter.fnTest = function(value) { return value != oValue1; }; break;
case "LT":
oFilter.fnTest = function(value) { return value < oValue1; }; break;
case "LE":
oFilter.fnTest = function(value) { return value <= oValue1; }; break;
case "GT":
oFilter.fnTest = function(value) { return value > oValue1; }; break;
case "GE":
oFilter.fnTest = function(value) { return value >= oValue1; }; break;
case "BT":
oFilter.fnTest = function(value) { return (value >= oValue1) && (value <= oValue2); }; break;
case "Contains":
oFilter.fnTest = function(value) {
if (typeof value != "string") {
throw new Error("Only \"String\" values are supported for the FilterOperator: \"Contains\".");
}
return value.indexOf(oValue1) != -1;
};
break;
case "StartsWith":
oFilter.fnTest = function(value) {
if (typeof value != "string") {
throw new Error("Only \"String\" values are supported for the FilterOperator: \"StartsWith\".");
}
return value.indexOf(oValue1) == 0;
};
break;
case "EndsWith":
oFilter.fnTest = function(value) {
if (typeof value != "string") {
throw new Error("Only \"String\" values are supported for the FilterOperator: \"EndsWith\".");
}
var iPos = value.lastIndexOf(oValue1);
if (iPos == -1){
return false;
}
return iPos == value.length - new String(oFilter.oValue1).length;
};
break;
default:
oFilter.fnTest = function(value) { return true; };
}
return oFilter.fnTest;
};
I guess you have to go workaround here to use event handler.