Skip to content
Newer
Older
100644 75 lines (47 sloc) 1.89 KB
cae19aa @jeremyw update readme
jeremyw authored Apr 3, 2012
1 # jquery-datatables-rails
557286b @rweng fix plugin loading, include fnReloadAjax plugin, change Readme, bump …
authored Sep 10, 2011
2
cae19aa @jeremyw update readme
jeremyw authored Apr 3, 2012
3 This gem packages the jQuery [DataTables](http://datatables.net/) plugin for easy use with the Rails 3.1+ asset pipleine.
557286b @rweng fix plugin loading, include fnReloadAjax plugin, change Readme, bump …
authored Sep 10, 2011
4
cae19aa @jeremyw update readme
jeremyw authored Apr 3, 2012
5 It provides all the basic DataTables files, but not (yet) the extras.
557286b @rweng fix plugin loading, include fnReloadAjax plugin, change Readme, bump …
authored Sep 10, 2011
6
cae19aa @jeremyw update readme
jeremyw authored Apr 3, 2012
7 ## Installation
46cc9c8 @rweng readme update
authored Mar 24, 2012
8
cae19aa @jeremyw update readme
jeremyw authored Apr 3, 2012
9 1. Add `gem 'jquery-datatables-rails'` to the assets group in your Gemfile and run `bundle install`.
07dc584 @ZenCocoon Add Twitter Bootstrap 2 support
ZenCocoon authored Apr 18, 2012
10 1. Add the JavaScript to `application.js`:
de3ae95 @rweng fix image paths
authored Sep 14, 2011
11
07dc584 @ZenCocoon Add Twitter Bootstrap 2 support
ZenCocoon authored Apr 17, 2012
12 `//= require dataTables/jquery.dataTables`
e743b16 @jeremyw rearrange assets to follow asset pipeline conventions
jeremyw authored Apr 2, 2012
13
07dc584 @ZenCocoon Add Twitter Bootstrap 2 support
ZenCocoon authored Apr 17, 2012
14 1. Add the stylesheets to `application.css`:
15
16 `*= require dataTables/jquery.dataTables`
17
18 ## Twitter Bootstrap 2 support
19
20 1. Add the JavaScript to `application.js`:
21
22 `//= require dataTables/jquery.dataTables.bootstrap`
23
24 1. Remove the initial stylesheets from `application.css`
25 1. Add the stylesheets to `application.css`:
26
27 `*= require dataTables/jquery.dataTables.bootstrap`
28
29 1. Initialize your datatables like this:
30
31 ```javascript
32 // For fluid containers
33 $('.datatable').dataTable({
34 "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
35 "sPaginationType": "bootstrap"
36 });
37
38 // For fixed width containers
39 $('.datatable').dataTable({
40 "sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
41 "sPaginationType": "bootstrap"
42 });
43 ```
557286b @rweng fix plugin loading, include fnReloadAjax plugin, change Readme, bump …
authored Sep 10, 2011
44
cae19aa @jeremyw update readme
jeremyw authored Apr 3, 2012
45 ## Plugins
557286b @rweng fix plugin loading, include fnReloadAjax plugin, change Readme, bump …
authored Sep 10, 2011
46
8d73f1c @ZenCocoon Add FixedColumns and FixedHeader extras
ZenCocoon authored Apr 28, 2012
47 Only a few plugins are currently available
48
49 * api
50 ** fnReloadAjax
51 * sorting
52 ** numbersHtml
53 * typeDetection
54 ** numberHtml
55
56 Check out the [assets directory][assets].
57
58 ## Extras
59
60 Only a few extras are currently available:
61
62 * FixedColumns
63 * FixedHeader
64
65 To add an extra into your application, include it like follow:
66
67 `//= require dataTables/extras/[ExtraName]`
68
69 Make sure to also add it's initialization as described on [datatables extras' site][datatables_extras]
70
557286b @rweng fix plugin loading, include fnReloadAjax plugin, change Readme, bump …
authored Sep 10, 2011
71
72 [assets]: https://github.com/rweng/jquery-datatables-rails/tree/master/vendor/assets/javascripts
8d73f1c @ZenCocoon Add FixedColumns and FixedHeader extras
ZenCocoon authored Apr 28, 2012
73 [extras]: https://github.com/rweng/jquery-datatables-rails/tree/master/vendor/assets/javascripts/dataTables/extras
74 [datatables_extras]: http://datatables.net/extras/
Something went wrong with that request. Please try again.