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

How to get the Node order in JCR query?

Amit_Kumar
Community Advisor
Community Advisor

Hi i just wanted to retrieve all nodes in the order that i see in siteadmin. How can i achive that?

1 Reply
Jitendra_S_Toma
Level 9
Level 9

If you are using Resource API to get the nodes in order, you can't get that. The node iterator returns nodes the way they are in the repository.

The Query could be a better option.

Jitendra

Amit_Kumar
Community Advisor
Community Advisor

I think i confused you, actually i want to get the repository order in query.

root-
    --child1
    -- child2
    -- child3

Now I want order as 1,2,3 in query not in node iteration.

Lokesh_Shivalingaiah
Community Advisor
Community Advisor

use root node of type sling:OrderedNode so when you list the child nodes under root, you get the order in which the nodes are created (1,2,3)