
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2017 06:28 PM
Hi All,
We recently had to fix this issue and figured I'd share it in case others have come across this - or might have a better solution.
We've on Jakarta Patch5. In the Portal (either /sp or in our case/hrportal) the Knowledge categories aren't sorted at all, they seem to be in a random order. As there is no 'order by' field or ability to order through the interface we updated the widget itself, KB Categories - KBv3, to allow for this - we copied the OOTB widget and created our own and added the lines 4-7 shown below in the 'Client Controller' code.
Hope this helps someone out there!
Solved! Go to Solution.
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2018 10:25 PM
Your code didn't work for me but it did get me thinking about it. Try inserting the following code near the bottom of the Server Script:
data.categories.sort(function(a,b) {
return (a.label.toLowerCase() > b.label.toLowerCase()) ? 1 : ((b.label.toLowerCase() > a.label.toLowerCase()) ? -1 : 0);
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2018 10:25 PM
Your code didn't work for me but it did get me thinking about it. Try inserting the following code near the bottom of the Server Script:
data.categories.sort(function(a,b) {
return (a.label.toLowerCase() > b.label.toLowerCase()) ? 1 : ((b.label.toLowerCase() > a.label.toLowerCase()) ? -1 : 0);
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2018 03:35 PM
Hi Seth,
That worked really well for me and I assume as it's server side has no impact on the client loading times either.
Will definitely use this instead in production.
Now I'm having the same issue with the articles themselves - they aren't displayed in any order - would you know where I could update code to have these also alphabetically ordered?
Thanks
Carl.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2018 02:53 PM
I have used the original code you provided and created the sorting successfully for the Documents as well - this means updating the 'KB Category Page' with the new code on the ;server source', code is below under the new commented section:
function showStarRating() {
if (options.show_star_rating == "Yes")
return true;
if (options.show_star_rating == "No")
return false;
if (gs.getProperty("glide.knowman.show_star_rating", "true") != "true")
return false;
return gs.hasRole(gs.getProperty("glide.knowman.show_star_rating.roles"));
}
//Code to sort documents by title
data.items.sort(function(a,b) {
return (a.title.toLowerCase() > b.title.toLowerCase()) ? 1 : ((b.title.toLowerCase() > a.title.toLowerCase()) ? -1 : 0);
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2018 08:47 PM
I have managed to get the server cod working better - see my latest update in a similar thread: