What is the best way to associate a primary key with a table row when using client-side templates, like jQuery Templates?
Should I do some kind of data binding or something? Or should I embed and hide the id in the table like this:
<script id="contactsTemplate" type="text/x-jquery-tmpl">
<table class="contacts">
<thead><tr><td class="ui-helper-hidden">Id</td><td>Name</td><td>City</td><td>State</td></tr></thead>
<tbody>
{{each contact}}
{{tmpl($value) '#contactTemplate'}}
{{/each}}
</tbody>
</table>
</script>
<script id="contactTemplate" type="text/x-jquery-tmpl">
<tr><td class="ui-helper-hidden">${id}</td><td>${name}</td><td>${city}</td><td>${state}</td></tr>
</script>
Isn't it bad to have my Ids accessible to the user, even if they are hidden? What other options do I have?