Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

What controls the order of new assets in card view for a folder?

Avatar

Level 2

I've noticed that in card view, newly added assets can either be at the top of the folder UI or at the bottom? All are marked "new" and folder properties are typically the same, sometimes orderable is selected (I understand orderable is for moving around in list view - not card).   Because there are often 1000's of assets in a folder I want to force all new assets to top of the folder for all folders in the system.   I know we can filter on last modified or use list view but that is another set of clicks and it would be good to know how AEM treats ingesting content into folders. 

7 Replies

Avatar

Employee

Technically the query that is run to collect the results in the card view of an assets folder is:

 

/jcr:root/content/dam/example/* order by @jcr:created descending

 

This means assets are sorted by the dam:Asset's jcr:created property in descending order.

 

Is it possible you are MOVING assets from one folder in AEM assets to another? Doing this does not change the moved asset's jcr:created date which might make it appear "older" than what you'd expect. 

Can you check the jcr:created dates on some of these assets that are showing up at the bottom of the folder listing and verifying their dam:Asset's jcr:created date is in fact newer (larger) than those assets that show first in card view?

 

Avatar

Level 2

Thank you David! 

@davidjgonzalezz 

As a test, I ingested a few new images to a folder that has images from several years ago. All the new assets are at the bottom of this folder, they have the "new" badge and when I looked at the json, they have a jcr:create date that is just now. Below is an image of the folder and a json for the one I just uploaded showing the jcr:create date

I created a ShareLink to the folder (but seeing the json is a bit tricky) https://author-gapinc.adobecqms.net/linkshare.html?sh=d2a3c8e2_556f_49cb_be4a_8096ca23add8.3MEaL707Q...

2020-10-19_16-24-34.png

2020-10-19_16-52-36.png

 

 

Avatar

Employee

Quite odd. What version of AEM are you on? Are you able to reproduce this locally?

 

Can you try in a new folder, adding assets 1 at a time, and see if each new one show up in the top left?

 

Can you look at what the node at "/libs/dam/gui/content/assets/jcr:content/views/card/datasource" is configured as? (This is the node that defines how the assets are listed in the card view).

 

davidjgonzalezz_0-1603289861424.png

 

 

Using AEM Chrome plugin, you can see the query that is triggered to generate this listing, which shows it just grabs everything in the folder and sorts by jcr:created...

 

2020-10-21 at 10.09 AM.png

Avatar

Level 2
We are on 6.4.7 (AMS) and have a 6.5.6 Dev. It also is happening on a 6.5.6 local instance. - Checking in CRX on these environments now. They appear to be OOTB and matching your screen capture all have InverseOrder Boolean True

Avatar

Level 2
@davidjgonzaleszz - update, we tested today and folder with orderable enable are the ones the place the new asset at the bottom. I will review where we have the setting enabled and take appropriate action.

Avatar

Employee
Ahh - that makes sense. Ordered folders list by their defined order - its in the name after all -- and new items go at the end of the list.

Avatar

Employee

Ah - so it sounds like your query is specifically about the Link Share card listing (which has a completely different implementation than the "normal" Assets Files view listing) .. it might be worth to update your Post title to reflect that.

 

The Link Share view, by default, lists assets in their "natural" order - it basically iterates over all the assets in a folder and displays them IN that order (for card view).

If you add: ...&sortDir=desc&sortName=created   to the folder URL you can force a sort order of the cards, however, the resources [1] that make up the Link Share UI are marked granite:internalArea [2] so you cannot (safely) overlay them to add these params.

The adhocsharedatasource.jsp script [3] however can be overlayed, and you can adjust the code to force default sorting on the "created" column and descending as shown in the attached screenshot..

 

 

    } else {
        ResourceSorter sorter = sling.getService(ResourceSorter.class);
        itr = sorter.sort(rv.iterator(), "created", true, rows, offset, null).iterator();
        rv.clear();
        while(itr.hasNext()) {
            Resource res = itr.next();
            rv.add(res);
        }
    }

 

 

adhocsharedatasource.png

 

[1] /libs/dam/gui/content/adhocassetsharepage/jcr:content/body/items/content/items/wizard/items/wizard.content/body/items/landingpage/views/card/datasource

[2] https://docs.adobe.com/content/help/en/experience-manager-64/deploying/upgrading/sustainable-upgrade...

[3] /libs/dam/gui/coral/components/admin/adhocassetshare/adhocsharedatasource/adhocsharedatasource.jsp