cancel
Showing results for 
Search instead for 
Did you mean: 

Enter is not working in F4.

santhu_gowdaz
Active Contributor
0 Kudos
402

Dear Experts,

                         After entering some search values in F4 Dialog, Click on search button is working. But entering some search values and click on "Enter" from keyboard is not working. how i can achieve this. Please help me.

Thanks and Regards,

Santhosh Gowda.

View Entire Topic
Private_Member_15166
Active Contributor
0 Kudos

Hi Santosh,

did you check for this event.JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.m.InputBase

Regards

Dhananjay

santhu_gowdaz
Active Contributor
0 Kudos

Hello ,

      How i can add this event inside my F4 Dialog? will you please provide some code snippet.

For example,

SAPUI5 Explored

After click on search button, it is calling search functionality. with out click on search button, just i will enter some search values in search input and press "Enter" from keyboard.how i can call this search method inside F4.

Private_Member_15166
Active Contributor
0 Kudos

Hi,

Here in the code, you will see this is an INPUT filed.

filterItems: [new sap.ui.comp.filterbar.FilterItem({ name: "s1", control: new sap.m.Input({

change: function(){

search code as implemented on click of button

}})})],

So define a method for change event for this input.

Regards

Dhananjay

Former Member
0 Kudos

In the change event of the searchInput , you can attach the handler to fire the press event of the searchButton.

change : function()

{

sap.ui.getCore().byId("id-of-button").firePress()

}

santhu_gowdaz
Active Contributor
0 Kudos

Uncaught TypeError: Cannot read property 'firePress' of undefined.

And also "search" button is created by framework itself. so it's not good idea to inspect element and getting that button id to use.

Private_Member_15166
Active Contributor
0 Kudos

The code which is written in search button event, you may write it in separate method and call that method from both change event of input as well as on click of search button event.

santhu_gowdaz
Active Contributor
0 Kudos

Search code inside input change method not good right? If i have 4 search inputs then i should write same code 5 time(In search method also i should write na).

santhu_gowdaz
Active Contributor
0 Kudos

I'm also thinking the same but one of my view have 10F4's, Again newly 10 search methods in controller(isn't looking very Bad!?). I'm looking for permanent solution with simple way.

Former Member
0 Kudos

sap.ui.comp.filterbar.FilterBar("id of filterbar")


Provide an Id for filterbar and in the change event call

sap.ui.getCore().byId("id-of-filterbar").fireSearch()

Just a guess. Not sure whether it works

Private_Member_15166
Active Contributor
0 Kudos

In my opinion, this is the solution.

If in your application you have 10 F4's and if for every f4 there is different search criteria then yes you have to create 10 different search event, but if they are the same then use the same method for every event.

Let's wait for some expert suggestions.

santhu_gowdaz
Active Contributor
0 Kudos

No , It's not the way to handle the problem. and also so many application we will develop, if you do it by same procedure like 10 methods to create extra methods. Application will be critical to handle.

     We Developer's always looking for the simple way. Am i right?

Private_Member_15166
Active Contributor
0 Kudos

Perhaps you didn't get what i was saying or maybe i didn't get you.

Whenever you will use sap.ui.getCore().byId("id-of-filterbar").fireSearch() this will fire the search event of filterbar. If i am not wrong.

So suppose i have written the code of that search event in another method and on search event that method is called.

Now i want to call the same from change event, again i will call the same method. I will reuse the method again and again. Both will be same, if i am not wrong.

santhu_gowdaz
Active Contributor
0 Kudos

Both will work. But what is the simple way here. Simply why should creating the methods.(Already told 10 F4's).