如何在过滤条中显示filterGroupItems?

时间:2018-06-15 08:06:24

标签: sapui5

我有以下过滤条:

<mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" controllerName="ch.example.northwind.controller.Customers"
    xmlns:fb="sap.ui.comp.filterbar" xmlns:html="http://www.w3.org/1999/xhtml">
    <Page title="{i18n>title}" showNavButton="true" navButtonPress="onNavPressBack">
        <content>
            <fb:FilterBar reset="onReset" search="onSearch" showRestoreButton="true" showClearButton="true" showGoOnFB="false">
                <fb:filterGroupItems>
                    <fb:FilterGroupItem groupName="G1" groupTitle="Group1" name="A" label="Company" labelTooltip="Tooltip GroupItem Example">
                        <fb:control>
                            <Input type="Text"/>
                        </fb:control>
                    </fb:FilterGroupItem>
                    <fb:FilterGroupItem groupName="G1" groupTitle="Group1" name="B" label="Customer">
                        <fb:control>
                            <Input type="Text"/>
                        </fb:control>
                    </fb:FilterGroupItem>
                    <fb:FilterGroupItem groupName="G2" groupTitle="Group2" name="A2" label="Supplier" labelTooltip="Tooltip GroupItem Example">
                        <fb:control>
                            <Input type="Text"/>
                        </fb:control>
                    </fb:FilterGroupItem>
                    <fb:FilterGroupItem groupName="G2" groupTitle="Group2" name="B2" label="Category">
                        <fb:control>
                            <Input type="Text"/>
                        </fb:control>
                    </fb:FilterGroupItem>
                </fb:filterGroupItems>
            </fb:FilterBar>
        </content>
    </Page>
</mvc:View>  

看起来像:

enter image description here

如何在栏上看到FilterGroupItem G1? 正如你在栏上看到的那样,它说:

  

要在此处显示过滤器,请将它们添加到过滤器

中的过滤器栏中
这是什么意思?我找不到过滤器属性。

1 个答案:

答案 0 :(得分:0)

如果您单击“过滤器”,则过滤器在那里,但是不会显示为默认过滤器。

要使它们在代码中默认可见,可以将FilterGroupItem的属性visibleInFilterBar设置为true。例如:

<fb:FilterGroupItem visibleInFilterBar="true" groupName="G1" groupTitle="Group1" name="A" label="Company" labelTooltip="Tooltip GroupItem Example">
    <fb:control>
         <Input type="Text"/>
    </fb:control>
</fb:FilterGroupItem>

指令To show filters here, add them to the filter bar in Filters涉及应用程序中的用法。在屏幕快照中,右侧有“过滤器”按钮。这就是所谓的“过滤器”。如果单击此按钮,您将可以看到所有过滤器。如果选中该复选框,它们将出现在“过滤器”栏中。它们只是没有默认添加。

相关问题