Hello,
I have installed Alfresco Community - 6.1.2 (r4fe1d0d0-b205).
When I go to Document library, change view to gallery and start quickly moving the slider, i'm getting the following error:
I tried to Google it and i found some results on Alfreco JIRA but they are quite old and seem to be resolved.
Do you have any idea how can i fix it?
Solved! Go to Solution.
The Solution for any interested parties:
1. Copy and create own documentlist-view-gallery.js and replace the `scope.widgets.galleryColumnsSlider.setColumnsPreference` with the following
scope.widgets.galleryColumnsSlider.setColumnsPreference = function _setColumnsPreference(numColumns) { if (numColumns == null) { numColumns = scope.widgets.galleryColumnsSlider.getColumnValue(); } galleryViewRenderer.galleryColumns = numColumns; var currTime = new Date(); if (currTime - galleryViewRenderer.lastChangeTime > CHANGE_TIME_WINDOW_MS) { galleryViewRenderer.lastChangeTime = currTime; scope.services.preferences.set(PREF_GALLERY_COLUMNS, numColumns); } };
Additionally, in the Alfresco.DocumentListGalleryViewRenderer constructor add `this.lastChangeTime = new Date();` and create new constance variable `CHANGE_TIME_WINDOW_MS = 500;`
2. To apply the changes above, override gallery view-renderer configuration and change dependency to the newly created js file
omg, I can't stop laughing. I just tried it out and it does gives an error! How did you find this error?
Every time you change the slider value, Alfresco calls /preferences endpoint for the logged in user, with a new value for galleryColumns. It tries to modify the cmerson node, and when you move the slider too fast, it gives concurrency error when writing to database.
Answering your original question... I have no idea how you could solve this error... Maybe overriding the slider change event listener, customize it and filter the calls to preferences endpoint to avoid concurrency errors.
I also found it ridiculous but for my client it's important.
Well, thanks for help. I wll try to figure out something.
The Solution for any interested parties:
1. Copy and create own documentlist-view-gallery.js and replace the `scope.widgets.galleryColumnsSlider.setColumnsPreference` with the following
scope.widgets.galleryColumnsSlider.setColumnsPreference = function _setColumnsPreference(numColumns) { if (numColumns == null) { numColumns = scope.widgets.galleryColumnsSlider.getColumnValue(); } galleryViewRenderer.galleryColumns = numColumns; var currTime = new Date(); if (currTime - galleryViewRenderer.lastChangeTime > CHANGE_TIME_WINDOW_MS) { galleryViewRenderer.lastChangeTime = currTime; scope.services.preferences.set(PREF_GALLERY_COLUMNS, numColumns); } };
Additionally, in the Alfresco.DocumentListGalleryViewRenderer constructor add `this.lastChangeTime = new Date();` and create new constance variable `CHANGE_TIME_WINDOW_MS = 500;`
2. To apply the changes above, override gallery view-renderer configuration and change dependency to the newly created js file
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.