And is there a reference for jsreport? The "learn" is rather disjointed and attempts to be all for all types but makes understanding the features of templates incomprehensible.
mdhampton
@mdhampton
Posts made by mdhampton
-
RE: Mostly a newb...
-
RE: Mostly a newb...
I don't think so, I remove the #ExcelNot and /ExcelNot and no difference. ExcelNot is simply toggling options based on html or not output.
function ExcelNot(opts) { if (ReportType == 'html-to-xlsx') { return opts.inverse(this); } else { return opts.fn(this); } }
This helper is working on other reports. I've compared this report to other reports, and they look the same, but obviously I'm doing something wrong...
-
Mostly a newb...
OK, I have several reports mostly working, but the subtotals are not -- just blank except for the "subtotal" label.
My totals are fine (computed in javascript). Using 2.4.0 (no choice, no upgrade until next year), javascript calling mongo db for data, template using handlebars, html, so nothing too fancy.in general, template is like this for table section:
<tbody> {{#each reportData}} <tr> <td>{{TopGroup}}</td> {{#each GroupData}} {{#unless @first}} <td>{{#ExcelType}}{{../TopGroup}}{{/ExcelType}}</td> {{/unless}} <td>{{Type}}</td> <td>{{SubType}}</td> <td data-cell-type="number" data-cell-format-str="0">{{Quantity}}</td> <td data-cell-type="number" data-cell-format-str="0">{{Price}}</td> <td data-cell-type="number" data-cell-format-str="0">{{NormalTotal}}</td> <td data-cell-type="number" data-cell-format-str="0">{{Discount}}</td> <td data-cell-type="number" data-cell-format-str="0">{{Total}}</td> </tr> {{/each}} {{#ExcelNot}} <tr class="subtotal"> <td> </td> <td> </td> <td>Subtotal</td> <td data-cell-type="number" data-cell-format-str="0">{{Quantity}}</td> <td data-cell-type="number" data-cell-format-str="0">{{Price}}</td> <td data-cell-type="number" data-cell-format-str="0">{{NormalTotal}}</td> <td data-cell-type="number" data-cell-format-str="0">{{Discount}}</td> <td data-cell-type="number" data-cell-format-str="0">{{Total}}</td> </tr> <tr> <td colspan=18> </td> </tr> {{/ExcelNot}} {{/each}}
Data is something like:
[{ "TopGroup": "Fred", "GroupData": [{ "TopGroup": "Fred", "Type": "Existing", "SubType": "Promo12", "Quantity": 10, "Price": 15.2, "NormalTotal": 152.0 "Discount": -23.0 "Total": 129.0 }, { "TopGroup": "Fred", "Type": "Existing", "SubType": "NA", "Quantity": 10, "Price": 15.2, "NormalTotal": 152.0 "Discount": 0 "Total": 152.0 }] }]
Notes: Made up names and data, not matching real report (except in layout). Could be typos, I hope not...