cancel
Showing results for 
Search instead for 
Did you mean: 

Image Preview dashlet - Change default sorting

oblivian
Champ in-the-making
Champ in-the-making
Hi guys,

I am trying to find where I can change the default sort behaviour of the Image Preview dashlet. I want the newest images to be displayed first, and not alphabetically as it is default. I'd also would like to change what kind of files the dashlet tries to display. The Image Preview dashlet shows empty thumbnails of DWG-files among others.

Please advice,

Thanks!
1 REPLY 1

richard_im
Champ in-the-making
Champ in-the-making
I think you can do this, but haven't tried this.

http://localhost:8080/alfresco/service/script/org/alfresco/slingshot/documentlibrary/images.get

If you review this webscript call, what you'll notice is there's a Filter object that sets some defaults based on the filter name being passed: "all" - Now, you don't want to modify the filter library since it can affect all other areas that use this, but you could effectively modify the images webscript.  Here's the small section that does it:
assets = search.query(
   {
      query: filterParams.query,
      page:
      {
         maxItems: (filterParams.limitResults ? parseInt(filterParams.limitResults, 10) : 0)
      },
      sort: filterParams.sort
   });

What you see bolded is the parsed filter parameters.  In here, since this only requires modifications for your image dashlet, you can set the sort object to be what you desire.  The default in the filter.lib is:
sort: [
         {
            column: "@{http://www.alfresco.org/model/content/1.0}name",
            ascending: true
         }]

What you can change it to is whatever indexed field, in your case modified date