I did have another question, I have created the templates I needed using a jsreport-cli project, but I wanted to use jsreport in my existing node.js application. Do I need jsreport or to extend jsreport-core with the recipes and engine i want to use?
edit: Would you prefer I create a new post?
M
Mika571
@Mika571
0
Reputation
6
Posts
646
Profile views
0
Followers
0
Following
Posts made by Mika571
-
RE: Asset helper complains about wrong spec
-
Asset helper complains about wrong spec
See the following playground here, I have a helper for picking what asset to draw, however jsreport complains about the param spec being wrong.
The first two each statements demonstrate that the helper returns a string as expected and that the assets can be found:
{{#each samples as |sample i|}} {{getLevelImage sample}} {{/each}} {{#each samples as |sample i|}} <img src="{#asset slyk-alert.svg @encoding=dataURI}" style="height:1.75%; margin: 0 auto;"> {{/each}}
Where the helper
getLevelImage
is:handlebars.registerHelper("getLevelImage", function(sample) { switch (sample.Results.Level) { case 1: return 'slyk-normal.svg @encoding=dataURI'; case 2: return 'slyk-warning.svg @encoding=dataURI'; case 3: return 'slyk-alert.svg @encoding=dataURI'; case 4: return 'slyk-critical.svg @encoding=dataURI'; default: return 'slyk-normal.svg @encoding=dataURI'; } });
This results in:
But the final line throws the error.
-
RE: handlebar-helper {{attr}} not working with colspan
Found the following workaround
{{lookup (first test) "a"}} {{lookup (last test) "a"}}
-
RE: handlebar-helper {{attr}} not working with colspan
How do I allow the handlebar-helper module in the playground?
-
handlebar-helper {{attr}} not working with colspan
I am trying to use the following helpers
{{attr colspan=(add samples.length 1)}}
while this appears to render correctly as plain text it does not work when on a<td>
element. Here is my code snippet:{{attr colspan=(add samples.length 1)}} <table class="table table-bordered table-condensed"> <tr> <td {{attr colspan=(add samples.length 1)}} class="sample-info-th text-center"> <strong>Sample History</strong> </td> <td class="sample-info-th text-center" colspan="2"></td> </tr> <tr> <td >Sample Date</td> {{#each samples as |sample index|}} <td > {{date sample._kmd.ect "DD/MM/YYYY"}} </td> {{/each}} </tr> <tr> <td>ID</td> {{#each samples as |sample index|}} <td >{{sample.BottleBarcode}}</td> {{/each}} </tr> <tr> <td>SMU</td> {{#each samples as |sample index|}} <td >{{sample.SMU}}</td> {{/each}} </tr> <tr> <td>Oil Changed</td> {{#each samples as |sample index|}} <td >{{sample.OilChanged}}</td> {{/each}} </tr> <tr>