I'm rendering some lists via JS link and I want to use postRender to move some containers via jQuery. Everything works fine as long as I'm displaying just one list. If I add several list webparts with that JSLink file it screws up the DOM Ids.
Simplyfied it is something like this:
var myHash = Math.floor((1 + Math.random()) * 0x10000);
fieldJsLinkOverride.Templates.Body = function() {
return '<div id="' + ctx.view + '-' + myHash + '">some content</div>';
}
fieldJsLinkOverride.Templates.OnPostRender = function() {
$('#' ctx.view + '-' + myHash ).append('other stuff');
}
But I can't generate a unique hash because of course the variable is global and gets overwritten if a JSLink file is called multiple times.
Is there some kind of hash unique for every single list stored in the ctx object I can use?