Closed kntmrkm closed 10 years ago
@kntmrkm,
Could you post your _datatable.rb (generate by ajax_datatable_rails)?
I think this problem is because some javascript options became incompatible with the bootstrap 3 updated js file (gem v2.2.0), but I am not sure. This is the reason I changed at semantic version. Unfortunately , the error is very poorly explained by DataTables, you can found several cases.
What you can do, it is a fork and try to update DataTable.js to last version (v1.10.2) and helping to contribute, maybe this can fix it.
My usage of DataTable it is very simple compared yours, but that it is working:
//.js.coffescript
tableElement = $('#cards_table')
tableElement.dataTable
ajax: $('#cards_table').data('source')
autoWidth: false
pagingType: 'full_numbers'
processing: true
serverSide: true
sWrapper: "dataTables_wrapper form-inline"
Maybe there are some fix to Bootstrap DataTables plugin too. I only can take a look on next weekend because I am travelling at now. I will appreciate your help or you can use the locked version '2.1.10.0.3' Thank you very much.
@kntmrkm , change paginationType: 'bootstrap'
to:
pagingType: 'full_numbers'
This is in the README, it is a good start.
ajax-datatable-rails use pagingType too
// users.js
jQuery(document).ready(function() {
$('#users-table').dataTable({
"processing": true,
"serverSide": true,
"ajax": $('#users-table').data('source')
"pagingType": "full_numbers",
// optional, if you want full pagination controls.
// Check dataTables documentation to learn more about
// available options.
});
});
Thank you for reply.
I tried paginationType: 'full_numbers'
.
Then it works well.
but, I don't know that "DataTable.js to last (v1.10.2)" works well. I can't try it. because I have not skill to fork. sorry (^ ^;,
I wait fix. Until fix, I can use 2.1.10.0.3.
and, This change( to full_numbers ). Layout is collapsed. so I wait fix (datatables.js?).
Thanks for great gem. Looking forward fix.
Enjoy Trip!
Thanks @kntmrkm, I am glad to know it worked.
I think, It is a issue with jquery.dataTables.bootstrap.css.scss
at your application.css.
It is strange, because it isn't happening inside my project.
Are you updated with bootstrap 3.1? Could you post your application.css, only the require session?
When I have a time, i will look at DataTable main repository. Maybe it is good to wait.
OK, I'm using bootstrap-sass-3.2.0.1.
*= require custom // this custom.css require bootstrap
*= require animate
*= require select2
*= require select2-bootstrap
*= require fullcalendar/fullcalendar
*= require morris
*= require bootstrap3-switch
*= require dataTables/jquery.dataTables
*= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
*= require dataTables/extras/dataTables.responsive
*= require editable/bootstrap-editable
*= require jquery.minicolors
*= require rails_bootstrap_forms
*= require humane/libnotify
*= require slidebars/slidebars
*= require slidebars_custom
*= require bootstrap-datepicker3
*= require_directory ./custom/
*= require_directory ./common/
*= require_self
custom.css.scss
@import 'bootstrap-sprockets';
@import 'bootstrap';
@import 'font-awesome';
・・・
and I require datatables.js after main content. ( require script part of "<% if yield(:script).empty? %>" below.)
<!DOCTYPE html>
<html lang="ja">
<% if yield(:head).empty? %>
<%= render 'common/head' %>
<% else %>
<%= yield :head %>
<% end %>
<body class="">
・・・・・
<% if yield(:script).empty? %>
<%= render 'common/script' %>
<% else %>
<%= yield :script %>
<% end %>
</body>
</html>
My reply is correct? sorry my English.
@kntmrkm , Please try the new release (2.2.2) there are several updates. Thanks
thanks.
but, error does not solved.
and, I tried without ajax-datatables-rails 0.2.0. but, same error occurred.
remove jquery.dataTables.css in your application.css *= require dataTables/jquery.dataTables
@mkhairi thank you for suggestion.
but, It does not solve.
Currently css setting is
*= require custom
*= require font-awesome
*= require animate
*= require select2
*= require select2-bootstrap
*= require fullcalendar/fullcalendar
*= require morris
*= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
*= require editable/bootstrap-editable
*= require jquery.minicolors
*= require rails_bootstrap_forms
*= require humane/libnotify
*= require slidebars/slidebars
*= require slidebars_custom
*= require bootstrap-datepicker3
*= require_directory ./custom/
*= require_directory ./common/
*= require_self
Hi. It works well. I might have to check mistakes.
Today, I have updated gems. to try rails 4.2 beta1.
and, updated jquery-datatables-rails to 2.2.3 and changed like below.
pagingType: 'full_numbers',
It is Bootstrap3 style. perfect.
thank you!
Hello. I'm using this gem in below env.
when using v. '2.1.10.0.3' , It works well. but after update to 2.1.10.0.4 or 2.2.0. An error occurred.
Uncaught TypeError: Cannot read property 'fnInit' of undefined
my JS file is.
What is problem?