Skip to Content

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Feb 12, 2017 at 05:13 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 12, 2017 at 06:25 PM

    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.

    Add comment
    10|10000 characters needed 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