0

I've been trying to make this work and I can't seem to find a solution:

I have a table and I have a basic initialization of the Datatables everything seems to work fine but once the responsive gets activated the details button doesn't work if I click on it it goes red with the - sign but the details doesn't appear.

This is my table:

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

This is my JS

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

1 Answer 1

0

If you use bootstrap try wrapping the <table> with <div class="table-responsive"> link

Some like:

<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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.