Some features in Ruby on Rails 3

Some features in Ruby on Rails 3

slevin123slevin123 Posts: 2Questions: 0Answers: 0
edited December 2011 in General
Hi,

I'm using dataTables with Ruby on Rails and everything work fine with the tables that I have, but theres one view where I also add some data via ajax
and datatables has an option for that

$('#lista1').dataTable().fnAddData( [] );

but when I show mi tables I'm using partials (from Rails), and that partial shows the entire row, not each col of that row.

Is there a way of adding that partial into a datatable row? because when I do

$('#lista1').dataTable().fnAddData( [
"<%= escape_javascript(render 'partial', :f => f)%>"
]);

it inserts only in the first col (wich is the expected behaviour).

Thanks in advance

Javier Q

Replies

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    The basic answer I'm afraid is no - DataTables requires the full row information to be available.

    Having said that what you could do is simply create an array of the required length with empty strings in the locations where you don't currently have the information available.

    Allan
  • slevin123slevin123 Posts: 2Questions: 0Answers: 0
    Thanks for your response.

    I thought so.... seems that dataTables won't let me do that
    I tried by writing the rails code inside the code that I mentioned, but seems that there's a lot of quotes ( " " ' ' )
    and the javascript won't accept them.

    Maybe there's a way of including code on each col of the datatable row I want to add


    Javier
This discussion has been closed.