Skip to content

Commit

Permalink
[Bug] Fix manual sorting (#723)
Browse files Browse the repository at this point in the history
* Change condition to pageSize and total instead of needsPaging

* Readd line

* Paging also needs an update for drag and drop single elements
  • Loading branch information
mattamon authored Oct 21, 2024
1 parent 689b94d commit 3da6e7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions public/js/pimcore/object/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ pimcore.registerNS("pimcore.object.tree");
}

// dropping objects not allowed if the tree/folder is paginated and sort by index (manual indexes) is enabled
if(((newParent.needsPaging) || (newParent.childNodes.length > pimcore.settings['object_tree_paging_limit'])) && (newParent.data.sortBy == "index")){
if(((!newParent.pagingData.canSortManually) || (newParent.childNodes.length > pimcore.settings['object_tree_paging_limit'])) && (newParent.data.sortBy == "index")){
pimcore.helpers.showNotification(t("error"), t("element_cannot_be_moved_because_target_is_paginated"), "error");
return false;
}
Expand Down Expand Up @@ -1218,7 +1218,7 @@ pimcore.registerNS("pimcore.object.tree");
if (currentSortMethod != sortBy && sortBy == "index") {

// Do not allow sort by index(Manual Indexes) for a paginated tree/folder
if(record.needsPaging) {
if(!record.pagingData.canSortManually) {
Ext.MessageBox.alert(
t("error"),
t("error_object_change_children_sort_to_index"));
Expand Down
3 changes: 2 additions & 1 deletion public/js/pimcore/overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ Ext.define('pimcore.data.PagingTreeStore', {
node.pagingData = {
total: data.total,
offset: data.offset,
limit: data.limit
limit: data.limit,
canSortManually: data.total < data.limit
}

me.superclass.onProxyLoad.call(this, operation);
Expand Down

0 comments on commit 3da6e7b

Please sign in to comment.