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.
Views
Replies
Total Likes
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?
Thank you David!
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...
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).
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...
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);
}
}
[1] /libs/dam/gui/content/adhocassetsharepage/jcr:content/body/items/content/items/wizard/items/wizard.content/body/items/landingpage/views/card/datasource
[3] /libs/dam/gui/coral/components/admin/adhocassetshare/adhocsharedatasource/adhocsharedatasource.jsp
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies