@@ -44,7 +44,7 @@ Currently `AjaxDatatablesRails` only supports `ActiveRecord` as ORM for
44
44
performing database queries.
45
45
46
46
Adding support for ` Sequel ` , ` Mongoid ` and ` MongoMapper ` is a planned feature
47
- for this gem. If you'd be interested in contributing to speed development,
47
+ for this gem. If you'd be interested in contributing to speed development,
48
48
please [ open an issue] ( https://github.com/antillas21/ajax-datatables-rails/issues/new )
49
49
and get in touch.
50
50
@@ -65,7 +65,7 @@ manually via the assets pipeline. If you decide to use the
65
65
` jquery-datatables-rails ` gem, please refer to its installation instructions
66
66
[ here] ( https://github.com/rweng/jquery-datatables-rails ) .
67
67
68
- ## Usage
68
+ ## Usage (0.3.0)
69
69
* The following examples assume that we are setting up ajax-datatables-rails for
70
70
an index of users from a ` User ` model, and that we are using postgresql as
71
71
our db, because you __ should be using it__ , if not, please refer to the
99
99
* For ` sortable_columns ` , assign an array of the database columns that
100
100
correspond to the columns in our view table. For example
101
101
` [users.f_name, users.l_name, users.bio] ` . This array is used for sorting by
102
- various columns.
102
+ various columns. The sequence of these 3 columns must mirror the order of
103
+ declarations in the ` data ` method below. You cannot leave this array empty as of
104
+ 0.3.0.
103
105
104
106
* For ` searchable_columns ` , assign an array of the database columns that you
105
107
want searchable by datatables. Suppose we need to sort and search users
@@ -155,6 +157,11 @@ def data
155
157
end
156
158
```
157
159
160
+ In the example above, we use the same sequence of column declarations as in
161
+ ` sortable_columns ` . This ordering is important! And as of 0.3.0, the first
162
+ column must be a sortable column. For more, see
163
+ [ this issue] ( https://github.com/antillas21/ajax-datatables-rails/issues/83 ) .
164
+
158
165
[ See here] ( #using-view-helpers ) if you need to use view helpers in the
159
166
returned 2d array, like ` link_to ` , ` mail_to ` , ` resource_path ` , etc.
160
167
@@ -286,6 +293,9 @@ So the query using the `.includes()` method is:
286
293
end
287
294
```
288
295
296
+ For more examples of 0.3.0 syntax for complex associations (and an example of
297
+ the ` data ` method), read
298
+ [ this] ( https://github.com/antillas21/ajax-datatables-rails/issues/77 ) .
289
299
290
300
### Controller
291
301
Set up the controller to respond to JSON
0 commit comments