Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data-sly-list and data-sly-repeat with previous and next item reference #95

Open
AnselmHa opened this issue Jul 11, 2022 · 0 comments
Open

Comments

@AnselmHa
Copy link

AnselmHa commented Jul 11, 2022

Expected Behaviour

For data-sly-list and data-sly-repeat there should be a prepared object reference to the previous and next item in the list. It is not right to have a dedicated custom SlingModel function for that, as I see a lot of useless code in a lot of SlingModels to get previous or next elements. It is also no business logic having next item e.g. if you have list items that have a button to get e.g. the label to the next or previous item. As workaround for next I can use the count field, but that is a hack and this is not working for previous item.

Actual Behaviour

https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md#226-list

Sample Code that illustrates the problem

<p data-sly-repeat="${myMap}">
    <span>key: ${item}</span>
    <span>value: ${myMap[item]}</span>
    <button class="prev">Click here to go to previous item: ${item.prev.label}</button >
    <button class="next">Click here to go to next item: ${item.next.label}</button >
</p>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant