Multiple Tables (and even single tab won't format properly

Multiple Tables (and even single tab won't format properly

Jan_IJan_I Posts: 3Questions: 0Answers: 0
edited March 2014 in General
Dear DataTables Community,

I m pretty new into programming with RoR but anyhow, I dearly wanted to implement the datatables functions. I followed the instructions from the respective Railscast (#340) and got one table to work and look properly. However, when I tried datatables on the rest of my tables nothing really happened. Now I have a page with three tables where one is formatted and the rest looks plain. I thought that multiple tables on one view might cause the problem but even when I visit the view of only one of the corresponding models (e.g. required_capacities model / localhost:3000/required_capacities, the table remains the same. I m really confused: why does one table work and all the others don't? Please help me, this is pretty important as this is an assignment due in ten days. I used the datatables debugger and thats my 6 character assterion:

ocezap

results.js.coffee:

jQuery ->
$('#results').dataTable()

jQuery ->
$('#required_capacities').dataTable()

results view:

Results



Period
Product
Inventory
Production





<% @results.each do |results| %>

<%= results.period %>
<%= results.product %>
<%= results.production %>
<%= results.inventory %>


<% end %>




Required Capacities



Period
Personal Capacities
Additional Personal Capacities
Technical Capacities





<% @required_capacities.each do |required_capacities| %>

<%= required_capacities.period %>
<%= required_capacities.personal_capacities %>
<%= required_capacities.additional_personal_capacities %>
<%= required_capacities.technical_capacities %>



<% end %>





Here's also my application.js:

//= require bootstrap
//= require jquery
//= require jquery_ujs
//= require dataTables/jquery.dataTables
//= require best_in_place
//= require jquery.purr

//= require_tree .

and my application.css

*= require_self

*= require jquery.ui.core
*= require jquery.ui.theme
*= require dataTables/src/demo_table_jui
*= require_tree .
*/


and last but not least, my gemfile:

group :assets do

gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
gem 'jquery-datatables-rails'
gem 'jquery-ui-rails'

Replies

  • Jan_IJan_I Posts: 3Questions: 0Answers: 0
    edited March 2014
    Well, I found the problem. The number of headers was higher than the number of variables which in turn lead to my issue. However, now I'm stuck formatting the table. I don't want these default search and show options, how do I disable them?

    I tried:

    jQuery ->
    $('#capacity1s').dataTable ({
    sPaginationType: "full_numbers"
    bJQueryUI: true
    bServerSide: true
    sAjaxSource: $('#capacity1s').data('source')
    "sDom": '<"top">rt<"bottom"flp><"clear">' });
  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    > I don't want these default search and show options, how do I disable them?

    You could remove them from the sDom option (drop the `f` and l` options).

    Allan
This discussion has been closed.