Sapui5 在自定义智能过滤器字段中保存值
在此智能过滤器示例中: 。。使用自定义字段。它的定义如下:Sapui5 在自定义智能过滤器字段中保存值,sapui5,Sapui5,在此智能过滤器示例中: 。。使用自定义字段。它的定义如下: <smartFilterBar:ControlConfiguration key="MyOwnFilterField" index="1" label="Custom Filter Field" groupId="_BASIC" width="300px" mandatory="mandatory" visibleInAdvancedArea="true"> <smartFilterB
<smartFilterBar:ControlConfiguration
key="MyOwnFilterField" index="1" label="Custom Filter Field"
groupId="_BASIC" width="300px" mandatory="mandatory"
visibleInAdvancedArea="true">
<smartFilterBar:customControl>
<m:Select id="foo" customData:hasValue="true">
<core:Item key="1" text="ONE"/>
<core:Item key="2" text="TWO"/>
<core:Item key="3" text="THREE"/>
</m:Select>
</smartFilterBar:customControl>
</smartFilterBar:ControlConfiguration>
保存变量时,将保存所有字段的值和选定键,自定义字段中的值除外
我还想将值存储在自定义字段中,在示例中,它是一个select。有什么方法可以做到这一点吗?因为我将自定义控件的选定键和值保存在JSON模型中,所以使用LREP有效负载保存和恢复它们相当简单。在过滤器数据上设置一个
\u CUSTOM
键将填充过滤器栏上设置的JSON模型,该模型称为fi1t3rM0d31
因此,对于这个领域:
<smartFilterBar:ControlConfiguration
key="OrderTypeId"
index="0"
label="{i18n>orders.enquiry.ordertype}"
groupId="_BASIC"
visibleInAdvancedArea="true"
controlType="input">
<smartFilterBar:customControl>
<MultiComboBox
customData:hasValue="true"
selectedKeys='{filters>/filters/multi/OrderTypeId}'
items="{
templateShareable: 'true', path: '/HelpValues',
filters: [{path:'FieldName', operator:'EQ', value1: 'VBAK-AUART'}]
}">
<core:ListItem key="{Key}" text="{Value}"/>
</MultiComboBox>
</smartFilterBar:customControl>
</smartFilterBar:ControlConfiguration>
。。。这反过来允许我在智能表上的beforeRebindTable
事件中生成这样的过滤器
//multi keys
Object.keys(data.multi || {}).forEach(k => {
var f = [];
data.multi[k].forEach(v => {
if (v) f.push(new Filter(k, FilterOperator.EQ, v));
});
if (f.length > 0) {
this.aFilters.push(new Filter(f));
}
});
天哪,这个问题让我意识到我创建的一个应用程序中有一个bug。“我从来没有注意到这一点。”法比奥帕戈蒂呵呵,很高兴这有帮助
//multi keys
Object.keys(data.multi || {}).forEach(k => {
var f = [];
data.multi[k].forEach(v => {
if (v) f.push(new Filter(k, FilterOperator.EQ, v));
});
if (f.length > 0) {
this.aFilters.push(new Filter(f));
}
});