Skip to content

Commit 699b804

Browse files
committed
Merge pull request jbox-web#85 from listx/master
README: minor clarifications for 0.3.0 behavior
2 parents 53b2fdc + 79284d8 commit 699b804

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Currently `AjaxDatatablesRails` only supports `ActiveRecord` as ORM for
4444
performing database queries.
4545

4646
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,
4848
please [open an issue](https://github.com/antillas21/ajax-datatables-rails/issues/new)
4949
and get in touch.
5050

@@ -65,7 +65,7 @@ manually via the assets pipeline. If you decide to use the
6565
`jquery-datatables-rails` gem, please refer to its installation instructions
6666
[here](https://github.com/rweng/jquery-datatables-rails).
6767

68-
## Usage
68+
## Usage (0.3.0)
6969
*The following examples assume that we are setting up ajax-datatables-rails for
7070
an index of users from a `User` model, and that we are using postgresql as
7171
our db, because you __should be using it__, if not, please refer to the
@@ -99,7 +99,9 @@ end
9999
* For `sortable_columns`, assign an array of the database columns that
100100
correspond to the columns in our view table. For example
101101
`[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.
103105

104106
* For `searchable_columns`, assign an array of the database columns that you
105107
want searchable by datatables. Suppose we need to sort and search users
@@ -155,6 +157,11 @@ def data
155157
end
156158
```
157159

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+
158165
[See here](#using-view-helpers) if you need to use view helpers in the
159166
returned 2d array, like `link_to`, `mail_to`, `resource_path`, etc.
160167

@@ -286,6 +293,9 @@ So the query using the `.includes()` method is:
286293
end
287294
```
288295

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).
289299

290300
### Controller
291301
Set up the controller to respond to JSON

0 commit comments

Comments
 (0)