Helper Issue : #js_if

:one: Issue

#js_if is true where it should be false

:two: code

{{#each reverse="true" items}} {{#js_if
              "this.Status === 'Completed'"}}
              <tr key="this.MilestoneId" class="completed">
                <td>{{this.MilestoneName}}</td>
                <td>
                  {{#if this.FilePath}}<a
                    class="splitlink external"
                    href="{{this.FilePath}}"
                    ><i class="icon material-icons">find_in_page</i></a
                  >{{/if}}<i class="icon material-icons">check</i>
                </td>
              </tr>
              {{/js_if}} {{#js_if "this.Status === 'In Progress'"}}
              <tr key="this.MilestoneId">
                <td>{{this.MilestoneName}}</td>
                <td>
                  {{#if this.FilePath}}<a
                    class="splitlink external"
                    href="{{this.FilePath}}"
                    ><i class="icon material-icons">find_in_page</i></a
                  >{{/if}}<small>In Progress</small>
                </td>
              </tr>
              {{/js_if}} {{#js_if "this.Status === 'Not Started'"}}
              <tr key="this.MilestoneId">
                <td>{{this.MilestoneName}}</td>
                {{#if this.FilePath}}
                <td>
                  <a class="splitlink external" href="{{this.FilePath}}"
                    ><i class="icon material-icons">find_in_page</i></a
                  >
                </td>
                {{else}}
                <td></td>
                {{/if}}
              </tr>
              {{/js_if}} {{/each}}

:three: data:

items:[{
FilePath:null
MilestoneId:54543
MilestoneName:"milestone started"
Status:"In Progress"
}]

:four: both Completed and In Progress conditions become true and rendering falsy data on UI where it should only render UI for In Progress condition

Thank you

At first sight I can’t find an error in your code. Did you try putting instead of " and vice versa?
For example:
{{#js_if 'this.Status === "Completed"'}}

You only need to use this. in {{js and {{#js_if
Normally you should not have a need to use this.variable

BTW it work properly
https://jsfiddle.net/j5whs817/

1 Like

Thank you for replying to @fabricio @Jacek_K

Syntax was wrong :

key="this.MilestoneId"    // wrong
key="{{this.MilestoneId}}"    // as noted in doc

still figuring out issue after syntax correction