The {{for start= end=}} {{:}} {{/for}} jsrender construct doesn't work in 1.x jsreport
-
The following:
{{for start=0 end=4}} {{:}} {{/for}}
doesn't work as expected (printing the index of the iteration. Also if changed to simply to:
{{for start=0 end=4}} W {{/for}}
it doesn't output 4 characters but only one instead.
-
I am reading the jsrender docs
https://www.jsviews.com/#fortag@start-endAnd it seems you need to pass the array the first and then you can use start/end to slice it.
I think you should create a custom helper that returns array [1..n], if you want to iterate over range 1..n.
-
it is a bit further down the page https://www.jsviews.com/#fortag@number-range
-
Ups. Thanks. Sorry for that.
It seems this is the new feature of the latest release.
https://github.com/BorisMoore/jsrender/commit/d3e2011486fe0c37316248d21f615df26cbb7c3b
We are one minor patch behind.The mainter notes that this 0.9.91 version should be soon followed by the official stable v1.0.
I think it makes sense for us to wait for it.You can now write a simple helper instead to support this. Does it work for you?
https://playground.jsreport.net/w/jan_blaha/tq_gS_IM
-
I was just wondering if it was a bug of some sort, as for a workaround, sure, something like that would work, thank you!
-
Good to know I won't have to write my custom range helper soon. :)