I have a series of nested objects. Say like... stores and items.
I have perhaps 10 stores, each with the same 10 items, displayed on the screen at the same time.
<template name='store'>
{{#each items}}
{{> item}}
{{/each}}
</template>
<template name='item'>
{{name}} {{qty}}
</template>
The main problem I have is trying to determine {{qty}} using a helper function. This is because the item inherently does not have a 'quantity', but rather it depends on which "store" it is related to. So I'd need to find the quantity based on the "store" + "item".
What's the "meteor way" of searching for this? Is it to store a bunch of data -* attributes in the DOM and search out my mongdb _id items via Jquery? I don't think mustache allows you to figure out where you came from and access a "parent scope's variables". And it's not like backbone where I can just add that link from the parent-store view to the child-item views.
I don't feel comfortable using session variables because I'm worried that that may cause race conditions (such as Session.get('current_store_id')).
Thanks!