Matrix Version: 6.29.0
I am working on creating a custom component where accordions can be dragged and dropped to change their order using jQuery Sortable and Squiz JS API to update the metadata values.
For example, we have five metadata fields for five accordions. If the user wants the third accordion to be number one. They can drag and drop the third accordion above the first accordion using JQuery sort instead of updating the metadata values manually. Once the positions are updated, Squiz JS API is used to switch the metadata values of 3 with 1 and 1 with 3 accordion values using the Set metadata method.
It’s working well. However once the metadata values are updated via JS API, asset locks are released in the background, and the user is unaware that the asset is locked. i.e., asset lock is released in the background but the save button is still visible in the front-end. Once I refresh the page, the save button disappears and the edit button is available to acquire the lock.
I wonder whether is there a way to trigger the JS API on the asset save event. At the moment Set Metadata event is triggered when the accordion is dragged and dropped.
Any help would be appreciated.
Thanks in advance