-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Helper in Loop Always Appears to be at the End #1849
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am trying to "group" the output by not repeating the value of a given field if it hasn't changed. I would rather avoid re-implementing the whole
#each
helper, so I thought that I could do a helper that would look at a previous row. However, the context I get inside such a helper doesn't appear to either include the array currently being looped or the position! I can pass in the@index
for the latter, but where is the object being looped?I've defined a dummy helper that just outputs the arguments. Tried calling both as block and normal helper. No luck. See https://jsfiddle.net/sempuzac/1/
E.g. given a data set (I know the data set is already sorted)
If I do
{{#each names}}
and put my new helper inside the loop thenthis
- OK_parent
in the context is just the root elementthis
is the row then the parent should be thenames
array, shouldn't it@index
and subtract one inside my Helper if I knew thatdata
element like the below - shouldn't it have the correct index for the row I call it from?Example of What I'm Trying to Do
Essentially, I can generate the following
What i want to generate is the following
The text was updated successfully, but these errors were encountered: