When we click on the family_type we need to get the materials. In the material_list helper loads only the last object i need to load the every family based on materials needed.
{{#each search_family_list}}
<li class="dropdown-submenu active"><a href="#" id="{{ family_id }}" class="family_type"><img src="" />{{ description }}</a>
<ul class="dropdown-menu">
{{#each material_list}}
{{#each this}}
<li><a href="" id="{{ material_id }}">{{ description }}</a></li>
{{/each}}
{{/each}}
</ul>
</li>
{{/each}}
This my helper class
Session.setDefault('materials_list',[]);
Template.header.events({
"click .family_type": function (event, template)
{
Meteor.call('get_family_materials',event.target.id,function(err,result){
if(err)
{
console.log(err);
}
else
{
Session.set('materials_list',result);
}
});
}
});
Template.header.helpers({
material_list: function ()
{
var family_id = this.family_id;
console.log(Session.get("materials_list"));
return Session.get("materials_list");
}
});
Please help me.