2011-10-17 38 views
0

當我觸摸表格行時,我想執行導航到其他屏幕。爲此我做了以下操作:Rhodes應用程序 - 如何瀏覽表格行觸摸屏幕?

<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> 

但是什麼也沒有發生。我也嘗試在td中應用<a href="<%= url_for :controller => :Products %>"></a>。仍然沒有成功。最後我嘗試了無序列表。仍然沒有發生。
我們如何導航到桌面上的其他屏幕觸摸?

+0

使用此JavaScript代碼 – Ron

+0

我不知道的JavaScript。一個例子會非常有幫助。 (使用javascript在行觸摸上導航的示例)。 – Nitish

回答

1

您需要在錨標記中指定一個操作,而不僅僅是一個控制器。您可以嘗試如下所示:

<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>