File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
lib/ajax-datatables-rails Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ def fetch_records
75
75
def sort_records ( records )
76
76
sort_by = [ ]
77
77
params [ :order ] . each_value do |item |
78
- sort_by << "#{ sort_column ( item ) } #{ sort_direction ( item ) } "
78
+ sort_by << "#{ sort_column ( item ) } #{ sort_direction ( item ) } #{ sort_nulls ( item ) } "
79
79
end
80
80
records . order ( sort_by . join ( ", " ) )
81
81
end
@@ -188,6 +188,11 @@ def sort_direction(item)
188
188
options . include? ( item [ :dir ] ) ? item [ :dir ] . upcase : 'ASC'
189
189
end
190
190
191
+ def sort_nulls ( item )
192
+ options = %w( first last )
193
+ options . include? ( item [ :nulls ] ) ? item [ :nulls ] . upcase : 'LAST'
194
+ end
195
+
191
196
def sortable_displayed_columns
192
197
@sortable_displayed_columns ||= generate_sortable_displayed_columns
193
198
end
You can’t perform that action at this time.
0 commit comments