Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

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

jayv25585659
Level 6
Level 6

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

1 Accepted Solution
Vijayalakshmi_S
Correct answer by
Community Advisor
Community Advisor

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

 

View solution in original post

0 Replies
Vijayalakshmi_S
Correct answer by
Community Advisor
Community Advisor

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

 

View solution in original post