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
BedrockMission!

Learn More

View all

Sign in to view all badges

content node ordering issue.

Avatar

Avatar
Validate 10
Level 3
vijayk87714775
Level 3

Likes

12 likes

Total Posts

81 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 3
vijayk87714775
Level 3

Likes

12 likes

Total Posts

81 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
vijayk87714775
Level 3

13-11-2018

@

Hi all,

We have authored a page and the nodes on the crxde getting created based on the sequence of the authoring. Let's say, I have 3 parsys on page par1 , par2 and par3. If I start authoring with par3 - it will be first node that gets created and then if I author par1 and then par2, then the order of nodes appears in page in JCR is jcr:content

|-par3

|-par1

|-par2

We've created a custom JSON response similar to -1.json which produce the JSON structure based on node order and it's being consumed for the mobile website. Now, the problem here is, since the par3 is being authored at start, it appears as first nodes in JSON however, the since the par3 is at the bottom of page in page component so when we see actual page, it appears at the bottom. But, as the mobile site is being generated based on JSON structure, the bottom content of page(desktop website) appears at the top on mobile website. So, is there any way to display the content in mobile site in similar order as it is on desktop website?

Thanks in advance.

View Entire Topic

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,115 likes

Total Posts

3,149 posts

Correct Reply

1,072 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,115 likes

Total Posts

3,149 posts

Correct Reply

1,072 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

14-11-2018

I did this experiment:

  • I opened localhost:4502/editor.html/content/we-retail/us/en/experience.html
  • At the bottom I added 3 text components to the responsive grid and added the content "text1", "text2" and "text3" into them.
  • I checked the order of the nodes below /content/we-retail/us/en/experience/jcr:content/root/responsivegrid and found, that the order in the JCR follows the order in the page: first there is the text component containing the text "text1", then the component for "text2" and finally the component for "text3".
  • Then I changed the order of the components in the page by dragging the text3 component directly below the text1 component, so on the page the order is now "page1", "page3", "page3".
  • I validated in the CRXDE that the ordering of the nodes in the JCR has changed as well.

This means, that in a parsys (or a responsive grid) the order of the components in the JCR and the order in the page are always identical. No matter in what order you created them. Just the order matters. And when you iterate through the child nodes of that "responsivegrid" node using your own code, you will get exactly this order!

Outside of the parsys or responsive grid the situation is different. Here the order typically does not matter, also because an author cannot just drag components into the page, but you as developer / template editor have to add them explicitly. And of course then order is not defined. But your (page) components should know how to deal with that situation, and you should add that logic to your custom JSON exporter too.

(And by the way: If you use the Sling Model Exporter, you can eliminate quite a bit of code ...)

HTH,

Jörg