cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Search help for select dialog in SAPUI5 mobile apps

arindam_samanta
Participant
1,473

Hi Experts,

I have created a selectDialog for mobile apps. I am facing the problem when I am trying to search value from the list in dialog. Below is my code:

_handleValueHelpSearch:function(oEvent)

    {

   var sValue = oEvent.getParameter("value");
   var oFilter = new sap.ui.model.Filter("Vendor",
   sap.ui.model.FilterOperator.Contains, sValue);
//   oEvent.getSource().getBinding("items").filter([ oFilter ]);
   var dialog = oEvent.getSource().getId();
   dialog.getBinding("items");

    },

The Variable dialog showing the accurate id for my dialog screen but showing exception for bold line. The exception is:

Uncaught TypeError: Object myDialog has no method 'getBinding'


Whereas this method is available for selectdialog. Due to this I cant search the element. It is showing no value.


I need help for this. Kindly provide the solutions.


Thanks & regards,

Arindam Samanta.


Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Likes

Example Posted Here

https://gist.github.com/anonymous/9132228

JSON Data is the following

  //The basic Test Data

  var listData = {

    Plants: [ {

        plant: "Plant ABC",

        id: "9001",

      }, {

        plant: "Plant DEF",

        id: "9002",

      }]

  };

And the Search and LiveChange work by filtering on the plant element

var  selectFilter = new sap.ui.model.Filter("plant", sap.ui.model.FilterOperator.Contains , sVal);

One of the key differences with both the Select Dialog and Table Select Dialog, are they have no render engine in them as they are Helper Controls, AKA a combination of standard SAPUI5 Controls packaged into another Control.

This means to get the data here is a bit different as the bound elements get passed down to the child control.  So you need to get them this way.

var itemsBinding = oEvent.getParameter("itemsBinding");

Hope this helps

Martin

Jayavardhan
Discoverer
0 Likes
i am facing same issue search not working though i have put the right code
former_member182372
Active Contributor
0 Likes

id is string, getBinding is defined on objkect, try

oEvent.getSource().getBinding("items");

arindam_samanta
Participant
0 Likes

Hi,

Actually I have written the below code for searching:    

var sValue = oEvent.getParameter("value");

        var oFilter = new sap.ui.model.Filter("Vendor",

        sap.ui.model.FilterOperator.Contains, sValue);

        oEvent.getSource().getBinding("items").filter([ oFilter ]);


I have searching value in oFilter but at the end it is showing no data whereas the data is available in list. So  I tried to break the code like previous post.

My code is right and bold part of the code is also right. Why then the my search is unsuccessful??

Kindly give the input.

Thanks & Regards,

Arindam Samanta.

former_member182372
Active Contributor
0 Likes

model is odata or json?

arindam_samanta
Participant
0 Likes

Hi,

Model is JSON.

Regards,

Arindam Samanta.

former_member182372
Active Contributor
0 Likes

post the json structure and the binding code