File tree Expand file tree Collapse file tree 2 files changed +13
-14
lines changed
lib/ajax-datatables-rails Expand file tree Collapse file tree 2 files changed +13
-14
lines changed Original file line number Diff line number Diff line change 1
- # -*- encoding : utf-8 -*-
1
+ # coding : utf-8
2
2
$:. push File . expand_path ( '../lib' , __FILE__ )
3
3
require 'ajax-datatables-rails/version'
4
4
Original file line number Diff line number Diff line change @@ -21,11 +21,14 @@ def datatable
21
21
@datatable ||= Datatable ::Datatable . new ( self )
22
22
end
23
23
24
- # Must overrited methods
25
24
def view_columns
26
25
fail ( NotImplemented , view_columns_error_text )
27
26
end
28
27
28
+ def get_raw_records
29
+ fail ( NotImplemented , raw_records_error_text )
30
+ end
31
+
29
32
def data
30
33
fail ( NotImplemented , data_error_text )
31
34
end
@@ -34,10 +37,6 @@ def additional_datas
34
37
{ }
35
38
end
36
39
37
- def get_raw_records
38
- fail ( NotImplemented , raw_records_error_text )
39
- end
40
-
41
40
def as_json ( *)
42
41
{
43
42
recordsTotal : records_total_count ,
@@ -51,6 +50,14 @@ def records
51
50
end
52
51
53
52
# helper methods
53
+ def connected_columns
54
+ @connected_columns ||= begin
55
+ view_columns . keys . map do |field_name |
56
+ datatable . column_by ( :data , field_name . to_s )
57
+ end . compact
58
+ end
59
+ end
60
+
54
61
def searchable_columns
55
62
@searchable_columns ||= begin
56
63
connected_columns . select ( &:searchable? )
@@ -63,14 +70,6 @@ def search_columns
63
70
end
64
71
end
65
72
66
- def connected_columns
67
- @connected_columns ||= begin
68
- view_columns . keys . map do |field_name |
69
- datatable . column_by ( :data , field_name . to_s )
70
- end . compact
71
- end
72
- end
73
-
74
73
private
75
74
76
75
def sanitize ( data )
You can’t perform that action at this time.
0 commit comments