-->

Is there a way to control the sorting order in the

2019-06-10 00:43发布

问题:

I'm developing AMP file for the Share tier and I want to override the search order. Currently, the sorting performed by fullName. In my case I need sorting by lastName.

In people-finder.js I found this line:

...
/**
* Build URI parameter string for People Finder JSON data webscript
*
* @method _buildSearchParams
* @param searchTerm {string} Search terms to query
*/
_buildSearchParams: function PeopleFinder__buildSearchParams(searchTerm)
{
    return "sortBy=fullName&dir=asc&filter=" + encodeURIComponent(searchTerm) + "&maxResults=" + this.options.maxSearchResults;
}
...

I think, that I should override sortBy parameter from fullName to lastName. I have done some experiments locally and saw that changes in those values make affect to the sorting.

How can I do it?


As Sanjay Patel noted, I created the following path and place relevant JavaScript files there:

share\src\main\amp\res\components\people-finder

I tried this way too - share\src\main\amp\web\components\people-finder\

But now on the embedded local Tomcat all works fine and I can see that JavaScript file was overridden:

But on the production server I get the following:

What I was tried to do:

  • delete alfresco and share directories from webapps;
  • clear the browser's cache;
  • uninstall AMP from Share and install again. Check, that it present in Share;
  • perform a full reindex with Solr

Nothing helps.. All of that not helped to override the people-finder.js

What could be the reason?

I would be very grateful for the information. Thanks to all.

回答1:

Create same path as people-finder.js file in eclips like share\src\main\amp\web\components\people-finder\ and place your modified file.