cancel
Showing results for 
Search instead for 
Did you mean: 

smartfilter bar to filter using List control

Former Member
0 Kudos

Hi,

I wanted to filter the List of notification using the smartfilter bar with custom controls. We have used annotations here. But here i am not able to get the filters. Kindly suggest if anything is wrong while adding filters.

My View XML code:

<smartFilterBar:SmartFilterBar
      id="smartFilterBar"
                 search="onSearch"
      entityType="NotificationHeader"
                 enableBasicSearch="false">
   <smartFilterBar:controlConfiguration>
      <smartFilterBar:ControlConfiguration key="NotificationNum" label="Notification">
         <smartFilterBar:customControl >
            <Input id="Notification" placeholder="Notification"/>
         </smartFilterBar:customControl>
      </smartFilterBar:ControlConfiguration>
   </smartFilterBar:controlConfiguration>
</smartFilterBar:SmartFilterBar>


<List items="{path: '/Notifications'}" id="notifList">
   <CustomListItem>

      <Panel expandable="true"
            expanded="true"
            expand="onPanelExpand">

         <headerToolbar>
            <Toolbar height="3rem">
               <Title text="{NotificationNum} {Description}" />
            </Toolbar>
         </headerToolbar>

         <content>
            <HBox width="100%">
               <HBox width="80%">
                  <Label text="{i18n>labelWorkOrder}" />
                  <Text text="{WorkOrder}" />
               </HBox>
               <FlexBox width="20%" direction="RowReverse" alignItems="End">
                  <Button text="Button2" />
                  <Button text="Button1" />
               </FlexBox>
            </HBox>


            <!-- fragment planned tasks table -->
            <core:Fragment fragmentName="com.bayer.ph.supercockpit.view.fragments.TasksTable" type="XML"/>

            <!-- fragment executed activities table -->

         </content>
      </Panel>

   </CustomListItem>
</List>

In My Controller i defined the method.

onSearch: function(oEvent) {
    var aFilters = this.getView().byId("smartFilterBar").getFilters();
    this.getView().byId("notifList").getBinding("items").filter(aFilters);
}

Please suggest

Accepted Solutions (0)

Answers (1)

Answers (1)

vedaradhya
Participant
0 Kudos

Hi Shrikant Naidu,

If you'r using custom control in SmartFilterBar, you also need to handle to build filter.

by default you won't get filter data in getFilters().

var aFilters = this.getView().byId("smartFilterBar").getFilters();

Build filter Change event of Input Control