I have a table that has a button on each TR that fires a jquery dialog, and i need to populate the dialog with the TD values of that TR #id
So i accomplished this by the following:
trid = $( this ).parents( 'tr' ).attr( "id" );
$('#'+trid+' td').each(function() {
$("#bdcontent").append("<li>"+$(this).html()+"</li>");
});
I use jsrender on multiple other parts of the same site, and didnt know how you could or should use jsRender in this respect
I suppose doing the following would get the job done, provided i knew the syntax to pass to teh template:
<script id="billDialogTemplate" type="text/x-jquery-tmpl">
<li>{{=???}}</li>
</script>
...
$('#'+trid+' td').each(function() {
$("#bdcontent").append( $("#billDialogTemplate").render( $(this) ));
});
but wanted to see if there was a cleaner/better way, if i should not consider jsrender templating for this type of action, or even if jsrender could accept data that was not in JSON format, or how i could build a json array from the TD values then pass to jsrender
when you want only to pass the contents, you can access the contents with the
#dataspecial keywordbut why are you using jsRender for this simple task? if you only want to pass the content of your
<td>why notif this is just an example and you have a complex template, you need to use
#datato access the raw information that was passed into your template