I want to perform navigate to other screen when I touch a table row. To do so I did the following :
<table>
<tr><a href="<%= url_for :controller => :Products %>"></a>
<td width="80"><img src="http://images.bizrate.com/resize?sq=60&uid=2605377575" width="80px"></img></td>
<td>
<table>
<tr>
<td width="260"><label for="label1">GPS Navigation System-$68.00</label></td>
</tr>
<tr>
<td width="260"><label for="label2">TomTom 3.5 One 125</label></td>
</tr>
</table>
</td>
</tr>
</table>
But nothing happened. I also tried to apply <a href="<%= url_for :controller => :Products %>"></a>
in td. Still no success. Finally I tried with unordered lists. Still nothing happened.
How can we navigate to other screen on table row touch?
You need to specify an action in your anchor tag, not just a controller. You can try something like the following:
<table>
<tr onclick="rowClick();">
<td width="80"><img src="http://images.bizrate.com/resize?sq=60&uid=2605377575" width="80px"></img></td>
<td>
<table>
<tr>
<td width="260"><label for="label1">GPS Navigation System-$68.00</label></td>
</tr>
<tr>
<td width="260"><label for="label2">TomTom 3.5 One 125</label></td>
</tr>
</table>
</td>
</tr>
</table>
<script type="text/javascript">
function rowClick() {
window.location = "<%= url_for :controller => :Products, :action => :show, :params => { :item_id => 1234 } %>";
}
</script>