2013-01-03 74 views
1

我想在新jQueryUI的選項卡中打開編輯動作打開新的標籤jQueryUI的

我的鏈接是

<%= link_to 'Show', student %> 

我希望在新的jQueryUI的選項卡中打開此。

怎麼辦?

這是我的索引頁

<html> 
<head> 
    <title>jQuery UI Accordion</title> 
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" /> 
    <script src="http://code.jquery.com/jquery-1.8.3.js"></script> 
    <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> 
    <script> 
    $(document).ready(function() { 
     var $tabs = $("#container-1").tabs(); 
    }); 
    </script> 
</head> 
<body> 

<div id="container-1"> 
    <ul> 
     <li><a href="#fragment-1">List</a></li> 
     <li><a href="#fragment-2">Knockout Test</a></li> 
     <li><%= link_to 'New Student', {:controller => "students", :action => "new"} %></li> 
    </ul> 

    <div id="fragment-1"> 
     <h1>Listing students</h1> 

     <table> 
      <tr> 
     <th><%=t :Name%></th> 
      <th></th> 
      <th></th> 
      <th></th> 
      </tr> 

     <% @students.each do |student| %> 
      <tr> 
      <td><%= student.name %></td> 
      <td><%= link_to 'Show', student %></td> 
      <td><%= link_to 'Edit', edit_student_path(student) %></td> 
      <td><%= link_to 'Destroy', student, :method => :delete, :data => { :confirm => 'Are you sure?' } %></td> 
      </tr> 
     <% end %> 
     </table> 
    </div> 

    <div id="fragment-2"> 
     <p>First name: <input data-bind="value: firstName" /></p> 
     <p>Last name: <input data-bind="value: lastName" /></p> 
     <p>Full name: <strong data-bind="text: fullName"></strong></p> 
    </div> 

</div> 

回答

2
$('#container-1').tabs("add", 'newtab', 'Title'); 
$('#newtab').html(newtabhtml); 
+0

你能解釋一下我怎麼在我的代碼把這個。我是新的jquery – Okky

+0

我想從該顯示頁面打開數據作爲新標籤 – Okky