Skip to content

Commit 03bf755

Browse files
committed
Update README
1 parent 93f753f commit 03bf755

File tree

2 files changed

+22
-33
lines changed

2 files changed

+22
-33
lines changed

README.md

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -42,38 +42,6 @@ You'll find a sample project here : https://ajax-datatables-rails.herokuapp.com
4242

4343
Its real world examples. The code is here : https://github.com/jbox-web/ajax-datatables-rails-sample-project
4444

45-
## Warnings
46-
47-
**Breaking changes :**
48-
49-
1) the *v1.0.0* version is a **major break** from *v0.4*.
50-
51-
* Datatables no longer inherits from `AjaxDatatablesRails::Base` but from `AjaxDatatablesRails::ActiveRecord` (this solves [#228](https://github.com/jbox-web/ajax-datatables-rails/issues/228))
52-
* The `view_context` is no longer injected in Datatables but only the `params` hash (see the [example](#4-setup-the-controller-action)). This will break calls to helpers methods.
53-
54-
To mitigate this 2 changes see the [migration doc](/doc/migrate.md).
55-
56-
2) the *v0.4* version is a **major break** from *v0.3*.
57-
58-
The core has been rewriten to remove dependency on [Kaminari](https://github.com/kaminari/kaminari) or [WillPaginate](https://github.com/mislav/will_paginate).
59-
60-
It also brings a new (more natural) way of defining columns, based on hash definitions (and not arrays) and add some filtering options for column search.
61-
62-
[See below](#3-customize-the-generated-datatables-class) for more infos.
63-
64-
To migrate on the v0.4 you'll need to :
65-
66-
* update your DataTables classes to remove all the `extend` directives
67-
* switch to hash definitions of `view_columns`
68-
* update your views to declare your columns bindings ([See here](#5-wire-up-the-javascript))
69-
70-
71-
## Documentation version
72-
73-
This documentation is about the `v1.x.x` release (master branch) of this gem.
74-
75-
You can still have access to the `v0.4.x` documentation on the [v0.4.x branch](https://github.com/jbox-web/ajax-datatables-rails/tree/v0.4.x).
76-
7745

7846
## Installation
7947

@@ -185,7 +153,7 @@ def view_columns
185153
@view_columns ||= {
186154
id: { source: "User.id" },
187155
first_name: { source: "User.first_name", cond: :like, searchable: true, orderable: true },
188-
last_name: { source: "User.last_name", cond: :like },
156+
last_name: { source: "User.last_name", cond: :like, nulls_last: true },
189157
email: { source: "User.email" },
190158
bio: { source: "User.bio" },
191159
}
@@ -202,6 +170,8 @@ end
202170
* `:null_value` for nil field
203171
* `Proc` for whatever (see [here](https://github.com/ajahongir/ajax-datatables-rails-v-0-4-0-how-to/blob/master/app/datatables/city_datatable.rb) for real example)
204172

173+
The `nulls_last` param allows for nulls to be ordered last.
174+
205175
See [here](#columns-syntax) to get more details about columns definitions and how to play with associated models.
206176

207177
You can customize or sanitize the search value passed to the DB by using the `:formatter` option with a lambda :

doc/migrate.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
## To migrate from `v0.4.x` to `v1.0.0`
22

3+
The *v1.0.0* version is a **major break** from *v0.4*.
4+
5+
* Datatables no longer inherits from `AjaxDatatablesRails::Base` but from `AjaxDatatablesRails::ActiveRecord` (this solves [#228](https://github.com/jbox-web/ajax-datatables-rails/issues/228))
6+
* The `view_context` is no longer injected in Datatables but only the `params` hash (see the [example](#4-setup-the-controller-action)). This will break calls to helpers methods.
7+
38
1) To mitigate the first change (Datatables no longer inherits from `AjaxDatatablesRails::Base` but from `AjaxDatatablesRails::ActiveRecord`)
49

510
Create a new `ApplicationDatatable` class and make all your classes inherits from it :
@@ -51,3 +56,17 @@ end
5156
This way, you can still use `def_delegators` in your datatables [as in the documentation](https://github.com/jbox-web/ajax-datatables-rails#using-view-helpers).
5257

5358
Note that the recommanded way is to use [Draper gem](https://github.com/drapergem/draper) to separate filtering logic from view/presentation logic [as in the documentation](https://github.com/jbox-web/ajax-datatables-rails#using-view-decorators).
59+
60+
## To migrate from `v0.3.x` to `v0.4.x`
61+
62+
The *v0.4* version is a **major break** from *v0.3*.
63+
64+
The core has been rewriten to remove dependency on [Kaminari](https://github.com/kaminari/kaminari) or [WillPaginate](https://github.com/mislav/will_paginate).
65+
66+
It also brings a new (more natural) way of defining columns, based on hash definitions (and not arrays) and add some filtering options for column search.
67+
68+
To migrate on the v0.4 you'll need to :
69+
70+
* update your DataTables classes to remove all the `extend` directives
71+
* switch to hash definitions of `view_columns`
72+
* update your views to declare your columns bindings ([See here](https://github.com/jbox-web/ajax-datatables-rails#5-wire-up-the-javascript))

0 commit comments

Comments
 (0)