Open difrnt opened 11 years ago
Yeah this should be straightforward using the _parent
variable in a nested template. You can see this here: http://tempojs.com/2.0/examples/parentdata.html
For some reason it's not working here and I'm not exactly sure why - maybe it's the fact that the nested templates are two levels deep. I will have to investigate this - do you need the extra nesting around episodes > episode -> []?
@mrolafsson the JSON is a mockup to reflect one that I can't post for security reasons and that I also have no control over the formatting. :-1:
Thanks, I'll take a look at the _parent var.
I understand completely - I'm trying to fix this now!
I think I'm on to something here - reporting back shortly.
@mrolafsson awesome! Thanks!
I've found the problem - looking for solution - thanks for your patience!
OK I hope I have fixed it - you can see your example here: http://jsfiddle.net/mr_olafsson/Jjwgb/ I altered HTML a little bit for my benefit - but principle is the same (I just prefer lists to divs with children).
Please can you check if this also works in IE? I can't test it here?
Works great (in Chrome/Firefox) in IE10 and IE9 I receive Sorry, JavaScript required!
Is that possibly just because IE doesn't like the mime type of the RAW from Github? I've tried testing the same file locally and when not using jsFiddle it works like a charm in IE 8 and 9.
Resolved one more corner case - how is it looking your side now?
Sorry about getting back to you a little later than I expected on this one. But on occasion I seem to receive a mixture of either blank data where it should be populated or the Sorry, JavaScript required! phrase.
Do you see any browser errors? It is a problem that Tempo fails to silently in some cases. I am working on a way around that.
You can now add your own error handler which might help with this:
Tempo.prepare('list').errors(function (err) {
console.log('Whoa! something happened!');
console.log(err);
}).render(data);
I take it this is fixed?
Here's a working jsfiddle with the JSON and in the current form it works. http://jsfiddle.net/FHZcA/
However is it possible to do something like: {{episodes.episode.name}}