【问题标题】:Responsive Details Not Showing On jquery-datatables-railsjquery-datatables-rails 上未显示响应详细信息
【发布时间】:2016-06-23 15:39:45
【问题描述】:

我一直在努力完成这项工作,但似乎找不到解决方案:

我有一个表,并且我对 Datatables 进行了基本初始化,一切似乎都可以正常工作,但是一旦激活响应式,详细信息按钮将不起作用,如果我单击它,它会变红并带有 - 符号,但详细信息不会不出现。

这是我的桌子:

<table id="tabla" class="display dt-responsive no-wrap" width="100%">
  <thead>
    <tr>
      <th>Profesor</th>
      <th>Materia</th>
      <th>Seccion</th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <% @profesors.each do |profesor| %>
      <tr>
        <td><%= profesor.profesor %></td>
        <td><%= profesor.materia %></td>
        <td><%= profesor.seccion %></td>
        <td><%= link_to 'Show', profesor %></td>
        <td><%= link_to 'Edit', edit_profesor_path(profesor) %></td>
        <td><%= link_to 'Destroy', profesor, method: :delete, data: { confirm: 'Are you sure?' } %></td>
        <td><%= link_to 'Alumnos', alumnos_path("prof" => profesor) %></td>
      </tr>
    <% end %>
  </tbody>
</table>

这是我的 JS

$('#tabla').DataTable({
    responsive: true
});

【问题讨论】:

    标签: ruby-on-rails jquery-datatables-rails


    【解决方案1】:

    如果您使用引导程序,请尝试将 &lt;table&gt; 包装为 &lt;div class="table-responsive"&gt; link

    有些喜欢:

    <div class="table-responsive">
      <table id="tabla" class="display dt-responsive no-wrap" width="100%">
        <thead>
          <tr>
            <th>Profesor</th>
            <th>Materia</th>
            <th>Seccion</th>
            <th></th>
            <th></th>
            <th></th>
            <th></th>
          </tr>
        </thead>
        <tbody>
          <% @profesors.each do |profesor| %>
            <tr>
              <td><%= profesor.profesor %></td>
              <td><%= profesor.materia %></td>
              <td><%= profesor.seccion %></td>
              <td><%= link_to 'Show', profesor %></td>
              <td><%= link_to 'Edit', edit_profesor_path(profesor) %></td>
              <td><%= link_to 'Destroy', profesor, method: :delete, data: { confirm: 'Are you sure?' } %></td>
              <td><%= link_to 'Alumnos', alumnos_path("prof" => profesor) %></td>
            </tr>
          <% end %>
        </tbody>
      </table>
    </div>
    

    【讨论】:

      猜你喜欢
      • 2013-05-05
      • 1970-01-01
      • 2012-05-13
      • 2017-12-16
      • 1970-01-01
      • 2016-07-05
      • 2021-12-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多