Using Java, how do I add a new node before/after an existing node?

Avatar

Avatar
Validate 25
Level 4
jayv25585659
Level 4

Likes

46 likes

Total Posts

131 posts

Correct reply

0 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Contributor 2
Ignite 5
View profile

Avatar
Validate 25
Level 4
jayv25585659
Level 4

Likes

46 likes

Total Posts

131 posts

Correct reply

0 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Contributor 2
Ignite 5
View profile
jayv25585659
Level 4

26-08-2020

I have this content hierarchy (see below). If I were to manually drag/drop components before and after the RTE component, the new components also show as before/after the RTE.

 

I want to programmatically add a new node (as an example, a reference component) and I already know how to create new node that as I got existing code I can use as a base. But what I do not know is how make sure it's added before/after the RTE as the order matters.

 

Thanks!

beforebeforeafterafter

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 500
MVP
Vijayalakshmi_S
MVP

Likes

573 likes

Total Posts

732 posts

Correct reply

241 solutions
Top badges earned
Boost 500
Give Back 50
Give Back 5
Ignite 10
Ignite 5
View profile

Avatar
Boost 500
MVP
Vijayalakshmi_S
MVP

Likes

573 likes

Total Posts

732 posts

Correct reply

241 solutions
Top badges earned
Boost 500
Give Back 50
Give Back 5
Ignite 10
Ignite 5
View profile
Vijayalakshmi_S
MVP

26-08-2020

Hi @jayv25585659,

If the parent node has an orderable child node -> true, 

Per the snapshot shared, assuming "section" node to be of type "nt:unstructured", above is possible.

Related screenshot for reference:

Vijayalakshmi_S_0-1598494401581.png

 

Answers (0)