cancel
Showing results for 
Search instead for 
Did you mean: 

smartfilterbar sapui5 not working

Former Member
0 Kudos

Hi all,

I am having a look on the smartcontrols. The smarttable is working fine for me. But the smartfilterbar is not working. Also the example given by the tutorial is not working. Is there something missing? In the given example I get not results back for the filter as well as the property preventInitialDataFetchInValueHelpDialog="false" is not working.

SAPUI5 Explored

Thanks for your support.

Silvia

Accepted Solutions (1)

Accepted Solutions (1)

saivellanki
Active Contributor
0 Kudos

Hi Silvia,

It all depends on your requirement, how you want to use the filter bar control.

If you're using the advanced search like field value search, then you have to place the logic in search event of filter bar control like below -


search: function(oEvent){

var oParams = oEvent.getParameter("selectionSet");       //Get Advanced Search values

oCompanyCode = oParams[0].getValue();          //Get Company Code value

oCurrencyCode = oParams[1].getValue();

//.... so on...

}

If you want to use basic search that is placed on left side, then you can use sap.m.SearchField control and say -


var oFilterBar = new sap.ui.comp.filterbar.FilterBar();

var oSearch = new sap.m.SearchField();

oFilterBar.setBasicSearch(oSearch);

Check this sample: Plunker

Use Basic Search to filter on CompanyCode / CurrencyCode / Company Name. (For this, you have to use KEYBOARD enter OR PRESS on search icon in search field.)

Use Advanced Search (For this, you have to use 'GO' button)

Regards,

Sai Vellanki.

Former Member
0 Kudos

I really want to use the smartfilterbar which is depending on the properties of the odata service. Thanks for your reply . Maybe this will help me for another requirement.

Do you also have an idea why the property preventInitialDataFetchInValueHelpDialog="false" is not working on desktop (chrome latest version)

Thanks in advance

Answers (2)

Answers (2)

Former Member
0 Kudos

Products.json is wrong. Categroy Name is given instead of key. When applying key instead of description filtering on Category is also working....see below. But preventInitialDataFetchInValueHelpDialog="false" is still not working for me on desktop devices.

"ProductId": "1239102",

    "Name": "Power Projector 4713",

    "Category": "Projector ",  ----> needs to be set to "PRO"

    "SupplierName": "Titanium",

    "Description": "A very powerful projector with special features for Internet usability, USB",

    "WeightMeasure": 1467,

    "WeightUnit": "g",

    "Price": 856.49,

    "CurrencyCode": "INR",

    "Status": "Available",

    "Quantity": 3,

    "UoM": "PC",

    "Width": 51,

    "Depth": 42,

    "Height": 18,

    "DimUnit": "cm"

yanev
Participant
0 Kudos

Hi Silvia,

I'm facing with the same problem. I don't see the input field from the smartfilterbar, only the buttons.

My $metadata looks like this:

I want the field to be of type Qmnum, so I'm setting the 'key' property to "Qmnum", but no filed is displayed.

This is my code in Eclipse:


createContent : function(oController) {

  var oPage = new sap.m.Page({

  title : "Selection Screen"

  });

  var oSFB = new sap.ui.comp.smartfilterbar.SmartFilterBar("smartFilterBar", {

  entityType: "oList",

  controlConfiguration: new sap.ui.comp.smartfilterbar.ControlConfiguration("", {

  key: "Qmnum",

  label: "Select Option1",

  visibleInAdvancedArea: true,

  preventInitialDataFetchInValueHelpDialog: true

  })

  });

  var oBtn = new sap.m.Button("selscrBtnGo", {

  text: "Go",

  width: "10rem",

  type: "Accept",

  tap: function(){

  oController.onPress()

  }

  });

  oPage.addContent(oSFB).addContent(oBtn);

  return oPage;

  }

asas8"

And this is the generated JSON structure:

Do you have any idea why this happens and how can I solve it?

Thanks.

Former Member
0 Kudos

Filterbar on Currency working but not on Category.

preventInitialDataFetchInValueHelpDialog="false" is working on smartphone but not on desktop.

Still investigation ...