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?

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?

3 Replies
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.


Community Advisor
Community Advisor

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

    -- child2
    -- child3

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

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)