File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
lib/ajax-datatables-rails/datatable/column Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ module Datatable
5
5
class Column
6
6
module Search
7
7
8
+ SMALLEST_PQ_INTEGER = -2147483648
9
+ LARGEST_PQ_INTEGER = 2147483647
10
+
8
11
def searchable?
9
12
@view_column . fetch ( :searchable , true )
10
13
end
@@ -82,6 +85,18 @@ def numeric_search
82
85
end
83
86
end
84
87
88
+ def is_searchable_integer?
89
+ return false unless table . respond_to? ( :engine )
90
+ table . engine . columns_hash [ field . to_s ] . sql_type == 'integer' && is_integer? ( search . value ) && is_out_of_range? ( search . value )
91
+ end
92
+
93
+ def is_out_of_range? search_value
94
+ Integer ( search_value ) > LARGEST_PQ_INTEGER || Integer ( search_value ) < SMALLEST_PQ_INTEGER
95
+ end
96
+
97
+ def is_integer? ( string )
98
+ true if Integer ( string ) rescue false
99
+ end
85
100
end
86
101
end
87
102
end
You can’t perform that action at this time.
0 commit comments