Using a row template I want to display a different template depending on whether a property on my model is true or false. Seems rather simple, but for whatever reason that property WILL NOT evaluate correctly if the condition is in its TD CELL in the row template that it is defined in.
Example:
I want to display text if my property IsPublished, is true; otherwise display a button so they can publish the record. In the attached file that wouldn't formatt correctly on this forum (just one thing after another, I freaking swear), I have an igGrid with two columns. The first is the boolean I want to evaluate. Since it won't evaluate in its own TD CELL, I have to create a stupid annoying dummy string property so I can evaluate the boolean in that string TD CELL. This works. In fact, anywhere before or after the TD CELL works. But not in. For reference "its TD CELL" is in reference to: <td data-key='${IsPublished}'>${IsPublished}</td>
What I can't figure out, is why if i move the same exact condition over one cell it bombs? Why? Like most examples, it probably won't get replicated. Cause the version I attached is stripped down from 10 columns. I can't post the rest online, only a subset.
I've tried debugging it by adding a space in between of the "{{ if" and I can see that it outputs the value to the following:
{{if true === true}} Published {{else}} <input button...... />{{/if}}
So I know it looks correct.
IE 9, FireFox, Safari all behave the same way.
CDN version 2059
Ran into the issue again and the function fixed it.
Thanks,
Hey sorry I mis-clicked suggest as answer on your post.
Anyways we have located the issue. I can offer you a temporary workaround which I hope would satisfy you:
Define the following:
function boolParse(val) {
return !!val && val !== 'false';
}
Inside your row template wrap the value in boolParse(${Discontinued}). Then you would be able to compare directly to true or to say {{if boolParse(${Discontinued}) }} and to NOT <!> it. Once the issue is fixed we would let you know!
Thank you for using the Infragistics forums.
CDN 2059
I tried comparing to the string 'true' and it worked for me. What version of the controls are you using?
I've tried all permutations of this but without success. It will properly evaluate in a different column however.
{{if ${Property} === true}}
{{if ${Property} == 'true'}}
{{if '${Property}' === 'true'}}
{{if '${Property}' == 'true'}}
The conditions above only work when it is evaluated in a column or TD CELL that doesn't match the properties column index. Very wierd.