Skip to Content
0

how to show history of previous searched values in sapui5 input field

Feb 12, 2017 at 04:54 PM

199

avatar image

Hi Gurus,

I have a requirement which is 'How to show the history of previous searched values in SAPUI5 Input Field'. Example: New SAP Service Marketplace input field.

Note: We already developed a suggested values for Input Field

Thanks in Advance

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Veeraraghavan Narasimhan
Feb 12, 2017 at 05:13 PM
0

Hello Kiran,

If you check the code on how this implemented, they have used the same suggest event available in sap.m.Input. Only caveat to that is when to retrieve the history and when to retrieve the suggestions.

This is how the code works

        var b = g + "suggestedterms.xsjs";
        if (this.m_currentTerm.length === 0) {
            b = g + "rec_search.xsjs"
        }
         

As you can see there are 2 services only server

1. suggestedTerms.xsjs - retrieves the suggestions

2. rec_search.xsjs - retrieve the recent searches

Based on length of the text they choose to call one or the other.

You could use the same logic as above

Thanks and Regards,

Veera

Share
10 |10000 characters needed characters left characters exceeded
Kiran VK Feb 12, 2017 at 06:25 PM
0

Hi Veera,

Thank you for valuable reply.

I understand the above suggestions and retrieve the recent searches .xsjs files but could you please explain me what is the variable 'b' and 'g'?

Thank You, Kiran.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hello Kiran,

I just copy pasted the code used in the service market place. Basically they are some variables used there. You dont need to have xsjs service. They could be some entity as well. The bottom line is there 2 endpoints one for recent searches and one for suggestion. Use them based on condition you want and they will work for your scenarios.

Thanks and Regards,

Veera

0