在新的jqueryui选项卡中打开

时间:2013-01-03 08:36:14

标签: ruby-on-rails-3 jquery-ui

我想在新的jquery-ui选项卡中打开编辑操作

我的链接是

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

1 个答案:

答案 0 :(得分:2)

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