12-03-2019 02:41 PM
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?
02-23-2022 06:01 AM
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
12-03-2019 04:11 PM
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.
12-05-2019 01:41 AM
I also found it ridiculous but for my client it's important.
Well, thanks for help. I wll try to figure out something.
02-23-2022 06:01 AM
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
Explore our Alfresco products with the links below. Use labels to filter content by product module.