Meteor table cells dynamic values from helper loading multiple times

23 views Asked by At

I need to display the values of a session object inside a table’s cells so that each row of the table cells represent each one of the object’s field Plan (see screenshot) and field price enter image description here

I have created a helper that returns the object,

  Template.stepFour.helpers({
    Plans(){
      console.log('result',Session.get("Plans"))
      return Session.get("Plans")
    },

and have used this helper in meteor html template as follows

<div class="gr-3 gr-12@tablet gr-12@mobile gr-12@mobile">
                                        <div class="featurecol">
                                            <div class="titlerow">
                                                <div class="package1">
                                                    <p>Product 1
                                                    <br>
                                                    </p>
                                                </div>
                                            </div>
                                            {{ #each Plans }}
                                            <div class="featuretablerow">
                                                <div><i class="fas fa-check"></i> {{ this.Plan.[0]}}</div>
                                            </div>
                                            {{/each}}

                                        </div>
                                    </div>
                                    <div class="gr-3 gr-12@tablet gr-12@mobile gr-12@mobile">
                                            <div class="featurecol">
                                                <div class="titlerow">
                                                    <div class="package2">
                                                        <p>Product 2
                                                        <br>
                                                        </p>
                                                    </div>
                                                </div>
                                                {{ #each Plans }}
                                                <div class="featuretablerow">
                                                    {{#if isNonZeroTx }}
                                                    <div><i class="fas fa-check"></i> {{this.Plan.[1]}}</div>
                                                    {{else}}
                                                    <div><i class="fas fa-times"></i></div>
                                                    {{/if}}
                                                </div>
                                                {{/each}}
                                            </div>
                                    </div>

                                    <div class="gr-3 gr-12@tablet gr-12@mobile gr-12@mobile">
                                            <div class="featurecol">
                                                <div class="titlerow">
                                                    <div class="package5">
                                                        <p>Price
                                                        <br>
                                                        <span class="texttype__tiny">euros</span>
                                                        </p>
                                                    </div>
                                                </div>
                                                {{ #each Plans }}
                                                <div class="featuretablerow">
                                                    <div>{{ this.price }}</div>
                                                </div>
                                                {{/each}}
                                            </div>
                                    </div>

this has as a result to load multiple times the object therefore I notice that there are delays in displaying the values, what it the right way to write it? thank you

0

There are 0 answers