cancel
Showing results for 
Search instead for 
Did you mean: 

Custom filter for sap.m.Table

Former Member
0 Kudos

Hi All,

I am adding custom filter for sap.m.Table based on search field input(input text must filter all columns data).

Which is the better way to approach from below;

1) Passing the search field text into the xsodata service using filter?

2) passing the search field text into the filter ? or any other way?

Regards,

    Mj.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Muni,

You can user View Settings Dialog - Standard functionality ( sap.m.ViewSettingsDialog). This will filter you model.

          <headerToolbar>
             
                <ToolbarSpacer></ToolbarSpacer>
                  <Button icon="sap-icon://drop-down-list" press="handleViewSettingsDialogButtonPressed" />
                </Toolbar>
            </headerToolbar>

handleViewSettingsDialogButtonPressed: function (oEvent)

  {

      if (!this._oDialog)

      {

        this._oDialog = sap.ui.xmlfragment("cgiPurchaseReq.view.Dialog", this);      

      }

      jQuery.sap.syncStyleClass("sapUiSizeCompact", this.getView(), this._oDialog);

      this.getView().addDependent(this._oDialog);

      this._oDialog.open();

  },

Create a Fragment and pass the values you want to filter.

<?xml version="1.0" encoding="UTF-8"?>

<core:FragmentDefinition

  xmlns="sap.m"

  xmlns:core="sap.ui.core">

  <ViewSettingsDialog

    confirm="handleConfirm">

    <sortItems>

      <ViewSettingsItem text="{i18n>TableItemCode}" key="Table>Matnr" selected="true" />

      <ViewSettingsItem text="{i18n>TableProductBrand}" key="Table>Maktx" />

       <ViewSettingsItem text="Uom" key="Table>Meins" />

    </sortItems>

  </ViewSettingsDialog>

</core:FragmentDefinition>

Please refer    SAPUI5 Explored

Hope this will help you.

Thanks and Regards

Abhijeet

former_member182372
Active Contributor
0 Kudos

sap.ui.model.Filter encapsulates $filter, so use filter on binding and odatamodel/binding will take of the rest