SAPUI5:自定义筛选包含来自控制器的动态绑定
我想使用一个自定义筛选,如此处所示:SAPUI5:自定义筛选包含来自控制器的动态绑定,sapui5,Sapui5,我想使用一个自定义筛选,如此处所示: 但问题是oloLocation.setFilterFunction不是一个函数:( 项目未定义到组合框中: <ComboBox id="my-id" selectionChange='onChange'> <core:Item key="{key}" text="{text}" /> </ComboBox> 有人有解决办法吗?我
但问题是oloLocation.setFilterFunction不是一个函数:(
项目未定义到组合框中:
<ComboBox id="my-id" selectionChange='onChange'>
<core:Item key="{key}" text="{text}" />
</ComboBox>
有人有解决办法吗?我找到了解决办法:我创建了一个控件ComboxContain,它覆盖ComboxFilterItems,如下所示:
ComboBox.prototype.filterItems = function(mOptions, aItems) {
var sProperty = mOptions.property,
sValue = mOptions.value,
bEmptyValue = sValue === "",
bMatch = false,
sMutator = "get" + sProperty.charAt(0).toUpperCase() + sProperty.slice(1),
aFilteredItems = [],
oItem = null;
aItems = aItems || this.getItems();
if (!bEmptyValue) {
for (var i = 0; i < aItems.length; i++) {
oItem = aItems[i];
// the item match with the value
bMatch = (oItem[sMutator]().match(new RegExp(sValue, "i")) !== null);
if (bMatch) {
aFilteredItems.push(oItem);
}
this._setItemVisibility(oItem, bMatch);
}
}
return aFilteredItems;
};
ComboBox.prototype.filterItems=函数(mOptions,aItems){
var sProperty=mOptions.property,
S值=mOptions.value,
bEmptyValue=sValue==“”,
b匹配=错误,
sMutator=“get”+sProperty.charAt(0.toUpperCase()+sProperty.slice(1),
aFilteredItems=[],
oItem=null;
aItems=aItems | | this.getItems();
如果(!bEmptyValue){
对于(变量i=0;i
然后我的观点是:
相关的github问题:。请升级到其中一个。
ComboBox.prototype.filterItems = function(mOptions, aItems) {
var sProperty = mOptions.property,
sValue = mOptions.value,
bEmptyValue = sValue === "",
bMatch = false,
sMutator = "get" + sProperty.charAt(0).toUpperCase() + sProperty.slice(1),
aFilteredItems = [],
oItem = null;
aItems = aItems || this.getItems();
if (!bEmptyValue) {
for (var i = 0; i < aItems.length; i++) {
oItem = aItems[i];
// the item match with the value
bMatch = (oItem[sMutator]().match(new RegExp(sValue, "i")) !== null);
if (bMatch) {
aFilteredItems.push(oItem);
}
this._setItemVisibility(oItem, bMatch);
}
}
return aFilteredItems;
};