Skip to Content
avatar image
Former Member

How to use custom control in SmartFilterBar and perform query with value in custom control?

tested on sapui5 version 1.28.6

In SmartFilterBar, if I define the a custom control, say checkbox. When press "search" button of filterbar. The filter value of the checkbox is not included as the filter of odata request. Thus the custom filter control has no use in query.

I think the problem maybe is that there's no documentation to describe, for a custom control, how to pass the value back to smartFilterBar to form a filter. Since custom control can be any type of control, there's no way for smartFilterBar to know how to get the value from the custom control and perform search with it.

If there's a way to do that, please advise.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Jul 13, 2016 at 01:24 PM

    Hello Aaron,

    Did you find solution for custom smart control, for example checkbox ? I tried a lot of functions from tutorials but with no result. Still no query in $filter from custom controls, only OData requests work for me.

    Thank you for reply.


    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 07, 2016 at 12:48 PM

    Hi Aaron,

    I just discovered your question because I am working on the same topic. I think you have to include the value from the custom control manually.

    I successfully added custom filter to the request in a method for the beforeRebindTable event of the SmartTable. If you have a look that the parameters that are in the event parameters of the method you can find a filter array. Add your filter to this array but be cautions with existing filters and handle them accordingly.

    A little example:


    smartfilter.JPG (49.9 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • Jan 22, 2016 at 08:29 AM


    Let look at my example :

    In your view :

    In your code:

    onBeforeRebindTable: function(oEvent) {
      var mBindingParams = oEvent.getParameter("bindingParams");
      var oSmtFilter = this.getView().byId("smartFilterBar");
      var oSelect = oSmtFilter.getControlByKey("MyOwnFilterField");
      var sVariant = oSelect.getSelectedKey();
      var newFilter = new sap.ui.model.Filter("Variant", sap.ui.model.FilterOperator.EQ, sVariant );

    In that way, the first query when you load your page will take in account your custom filters.


    smartTableCtrl.png (60.4 kB)
    rapportFond.png (62.7 kB)
    Add comment
    10|10000 characters needed characters exceeded