How to display recent search first on dropdown search widget

I have a list of user to display in dropdown search but want to show recent use user first. 

I used server action to get recent user first then save to local variable. Then get all users and append it to local variable. 

User position is correct form debug view but after binding to widget it automatically sort by Name. 

I have also tried get all users first then user ListInsert to insert recent user to the top but doesn't work. 

- Constance


DropDownSearch.oml

Hi,

Just need to put this: 

By using this setting your list will appear in the order they were given.

I updated your .oml please take a look.

Cheers,

Khuong

DropDownSearch.oml

It work! thanks. 

Basically you want to show the user list in dropdown with order of recent search. So for this case you can maintain a table in that table you will maintain the entry with UserId and Search DateTime. Whenever search make entry in this table.

To show the data in dropdown just join this table with user table and apply sorting on the basis of Search DateTime.

Regards

Hi,

Just need to put this: 

By using this setting your list will appear in the order they were given.

I updated your .oml please take a look.

Cheers,

Khuong

DropDownSearch.oml

It work! thanks. 

Hi @Constance Li ,
Good Day!

I faced the similar issue of Recent Search, I followed some of the steps and a forge component which helps us to store the client side searched values.

1. Install the forge component Local Storage Reactive in your environment.


2. Add the usage of client actions as per your requirement.

3. Create one client action And assign the text output from GetItemLocalStorage & SetItemLocalStorage.

4. Use created client action on Onready

Result : Checked with Lawarance name in search input.

After Refreshing the Screen below image you can see the Recent searched Keywords.

Please check the below demo link.

DEMO LINK

I hope this helps.

- Palle Vijay Bhaskar Reddy

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.