cancel
Showing results for 
Search instead for 
Did you mean: 

How to do Pagination on search Results in AIKAU?

jayachender
Confirmed Champ
Confirmed Champ

Hi,

I am using aikau "alfresco/lists/AlfSortablePaginatedList" widget for populating list of values coming from Custom Data Search Web Script.Basically we need to have a pagination on the search results after the search operation is done and not at the time of initial page loading.

Thanks,

Jay

3 REPLIES 3

afaust
Legendary Innovator
Legendary Innovator

I am not 100% sure what you mean by your question. When you use the paginated list from Aikau for displaying search results, then the act of loading the results IS the search operation, and the list will load only that page of results your users wants to display using pagination feature. There should be no disconnect / separation of the search operation and a subsequent pagination - both are done in one operation at the same time.

If you have two web scripts - one for searching and one for loading the results - then you either may have to refactor those to combine them (provided search is a cheap-ish operation). If search is not cheap-ish (e.g. not using the Alfresco search and instead loading data from some external source) then you can configure the list to not load results upon page load and use a "topic" to be notified when it should (re-)load data. You then would have to publish to that topic once the search operation has completed to trigger the load.

Hi Axel,

Thanks for your reply. I will try explain my scenario in a more detailed way. I am having a search form developed on top of Aikau. This search form is having around 10-12 fields where user can do a parameterized search by using these search fields. I have a custom data-webscript that handles this search operation and returns the desired list of results as per the requested query in JSON format. After this, I am  publishing this JSON response to my AlfSortablePaginatedList in order to populate my results in a table on the Aikau page. This flow is working fine but I am unable to achieve Pagination on it.

I tried using this scenario on the OOTB un-parameterized services like /api/people and api/groups and it worked fine. The difference here is only that these services are mere GET services which do not expect a parametrized query. Whereas in my case I am sending the payload of search parameters to my search service in order to fetch the desired result. Let me know if he you need information.

Thanks

Jay

afaust
Legendary Innovator
Legendary Innovator

It is not the purpose of the AlfSortablePaginatedList to have a full list of values supplied to it that it then paginates over in-memory. Every time the list needs to display a different page / sort order etc. it will "ask" for the sub-set via a publication. Typically this will involve a ReST call. Alternatively, the publication could be dealt with by a custom service you provide which holds the full list of results and only responds with the relevant sub-set.

Anytime you have some sort of coordination requirement between different widgets in an Aikau page you may have to provide a custom service to handle the pubSub interactions and shared state (unless the interaction is so trivial it can already be solved with existing pubSub capabilities of the widgets).

Yet another alternative is using the FilteredList widget which can include search fields as part of the table and will use the input in those fields as filters to the data load of the table. That way the table can serve both as the search form and the result display, and you should not have to coordinate anything between the two. You'd only have to adapt the web script to deal with the way the search parameters are provided.