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

Sightly condition check

Avatar

Avatar
Validate 1
Level 2
cmr96960454
Level 2

Likes

3 likes

Total Posts

15 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 3
Give Back
View profile

Avatar
Validate 1
Level 2
cmr96960454
Level 2

Likes

3 likes

Total Posts

15 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 3
Give Back
View profile
cmr96960454
Level 2

31-05-2019

Hello all,

Below is my code.  actually i am displaying list of children (in 2 sections) on click in header navigation.

<ul class="nav navbar-nav" data-sly-list.level1="${header.mainNavPages}" >

<div class="col-md-3 col-sm-4">

<ul class="dropdown-list" data-sly-list.level2="${level1.children}">

<li data-sly-test="${level2List.index <= level1.mainNavForkIndexValue}"></li>

-----------

</ul></div>

<div class="col-md-3 col-sm-4">

<li data-sly-test="${level2List.index > level1.mainNavForkIndexValue}"></li>

----

</ul></div>

Now my requirement , i want to display same results in 3 sections, i want to segregate the list of children in 3 sections (3 divs).

Earlier  2 sections (50% in first sections and another 50% in 2nd section)

"${level2List.index <= level1.mainNavForkIndexValue}",   ${level2List.index > level1.mainNavForkIndexValue}">

Now 3 sections (30,30,40 or  33,33,34%)

I need suggestion for sightly condition on how to achieve this.

Replies

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

31-05-2019

Hi,

Use Sling Model to return list(s) based on conditions. You can pass as level1.mainNavForkIndexValue parameter in Java and do all business logic there and return 3 lists.

Avatar

Avatar
Validate 1
Level 2
cmr96960454
Level 2

Likes

3 likes

Total Posts

15 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 3
Give Back
View profile

Avatar
Validate 1
Level 2
cmr96960454
Level 2

Likes

3 likes

Total Posts

15 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 3
Ignite 1
Give Back 3
Give Back
View profile
cmr96960454
Level 2

03-06-2019

HI Arun,

Thanks for reply. I am just doing POC for this. I am passing string to sightly. But this is not working for me. Could you please suggest??

<div class="collapse navbar-collapse" id="main-navbar" data-sly-use.mySlingModal="${'com.ingredion.aem.core.components.content.SlingFirst @ text='Some text'}">

@Model(adaptables = [SlingHttpServletRequest, Resource])

final class SlingFirst extends AbstractComponent {

   @RequestAttribute
  @Optional
   private String reversed;;

   @PostConstruct
   public void init() {

  String text = get("text", String.class);

   reversed = new StringBuilder(text).reverse().toString();

  }

   public String getReversed() {

   return reversed;

  }

  }

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

04-06-2019