Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xwiki-platform
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XWiki
xwiki-platform
Commits
e770d20f
Commit
e770d20f
authored
4 years ago
by
Marius Dumitru Florea
Browse files
Options
Downloads
Patches
Plain Diff
XWIKI-17425: A tree node with checkboxes and pagination is removed from the tree when you open it
parent
326a7378
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xwiki-platform-core/xwiki-platform-tree/xwiki-platform-tree-webjar/src/main/webjar/tree.js
+11
-2
11 additions, 2 deletions
...m-tree/xwiki-platform-tree-webjar/src/main/webjar/tree.js
with
11 additions
and
2 deletions
xwiki-platform-core/xwiki-platform-tree/xwiki-platform-tree-webjar/src/main/webjar/tree.js
+
11
−
2
View file @
e770d20f
...
...
@@ -132,7 +132,13 @@ define(['jquery', 'JobRunner', 'jsTree', 'tree-finder'], function($, JobRunner)
var
addMoreChildren
=
function
(
tree
,
paginationNode
)
{
// Mark the pagination node as loading to prevent multiple pagination requests for the same offset.
var
paginationElement
=
tree
.
get_node
(
paginationNode
.
id
,
true
);
if
(
paginationElement
.
hasClass
(
'
jstree-loading
'
))
return
;
if
(
!
paginationElement
.
length
||
paginationElement
.
hasClass
(
'
jstree-loading
'
))
{
// The pagination element could be missing, even if the pagination node is present in the tree model, if the
// pagination node was not yet drawn, i.e. if we call this function too early (e.g. the pagination node was just
// added to the tree model but the tree was not re-rendered). This function needs to be called after the
// pagination node is drawn.
return
;
}
paginationElement
.
addClass
(
'
jstree-loading
'
);
// Replace the pagination node with the nodes from the next page.
var
parent
=
tree
.
get_node
(
paginationNode
.
parent
);
...
...
@@ -484,7 +490,10 @@ define(['jquery', 'JobRunner', 'jsTree', 'tree-finder'], function($, JobRunner)
return
this
.
on
(
'
select_node.jstree
'
,
function
(
event
,
data
)
{
var
tree
=
data
.
instance
;
var
selectedNode
=
data
.
node
;
if
(
selectedNode
.
data
&&
selectedNode
.
data
.
type
===
'
pagination
'
)
{
// Load more child nodes when the pagination node is selected, if the selection is a result of an action performed
// by the user (e.g click on the pagination node). We need to make this distinction because sometimes we want to
// select the pagination node without activating it (i.e. without replacing it with the next child nodes).
if
(
selectedNode
.
data
&&
selectedNode
.
data
.
type
===
'
pagination
'
&&
data
.
event
)
{
addMoreChildren
(
tree
,
selectedNode
);
}
else
if
(
data
.
event
&&
!
$
(
data
.
event
.
target
).
hasClass
(
'
jstree-no-link
'
)
&&
$
(
data
.
event
.
target
).
closest
(
'
.jstree-no-links
'
).
length
===
0
)
{
...
...
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