Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hierarchy_manager-3343978
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
hierarchy_manager-3343978
Commits
445c692a
Commit
445c692a
authored
3 years ago
by
Mingsong Hu
Browse files
Options
Downloads
Patches
Plain Diff
Refresh whole tree after an item is relocated under a non-draggable parent
parent
2183646c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
js/Plugin/jstree/hm.jstree.js
+19
-10
19 additions, 10 deletions
js/Plugin/jstree/hm.jstree.js
with
19 additions
and
10 deletions
js/Plugin/jstree/hm.jstree.js
+
19
−
10
View file @
445c692a
...
@@ -124,19 +124,28 @@
...
@@ -124,19 +124,28 @@
else
{
else
{
var
parentText
=
parent_node
.
text
;
var
parentText
=
parent_node
.
text
;
}
}
// Update the nodes changed in the server side.
if
(
parent_node
.
data
&&
!
parent_node
.
data
.
draggable
)
{
if
(
response
.
updated_nodes
)
{
// The parent node is not draggable.
let
update_nodes
=
response
.
updated_nodes
;
// We have to update all duplicated nodes
for
(
const
id
in
update_nodes
)
{
// by refreshing the whole tree.
let
node
=
thisTree
.
get_node
(
id
);
thisTree
.
refresh
();
if
(
node
)
{
}
node
.
data
.
weight
=
update_nodes
[
id
];
else
{
// Update the nodes changed in the server side.
if
(
response
.
updated_nodes
)
{
let
update_nodes
=
response
.
updated_nodes
;
for
(
const
id
in
update_nodes
)
{
let
node
=
thisTree
.
get_node
(
id
);
if
(
node
)
{
node
.
data
.
weight
=
update_nodes
[
id
];
}
}
}
//Refresh the tree without reloading data from server.
thisTree
.
sort
(
parent_node
,
true
);
thisTree
.
redraw
(
true
);
}
}
//Refresh the tree without reloading data from server.
thisTree
.
sort
(
parent_node
,
true
);
thisTree
.
redraw
(
true
);
}
}
let
message
=
Drupal
.
t
(
'
@node is moved to position @position under @parent
'
,
{
'
@node
'
:
data
.
node
.
text
,
'
@parent
'
:
parentText
,
'
@position
'
:
data
.
position
+
1
});
let
message
=
Drupal
.
t
(
'
@node is moved to position @position under @parent
'
,
{
'
@node
'
:
data
.
node
.
text
,
'
@parent
'
:
parentText
,
'
@position
'
:
data
.
position
+
1
});
// Inform user the movement.
// Inform user the movement.
drupalMessages
.
clear
();
drupalMessages
.
clear
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment