cancel
Showing results for 
Search instead for 
Did you mean: 

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

former_member213400
Active Participant
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member213400
Active Participant
0 Kudos

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.

former_member228602
Contributor
0 Kudos

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

former_member228602
Contributor
0 Kudos

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