Module: Effective::EffectiveDatatable::Hooks
- Included in:
- Datatable
- Defined in:
- app/models/effective/effective_datatable/hooks.rb
Instance Method Summary collapse
-
#finalize(collection) ⇒ Object
Called on the final collection after searching, ordering, arrayizing and formatting have been completed.
-
#order_column(collection, table_column, direction, sql_column_or_array_index) ⇒ Object
Override this function to perform custom ordering on a column direction will be :asc or :desc.
-
#search_column(collection, table_column, search_term, sql_column_or_array_index) ⇒ Object
Override this function to perform custom searching on a column.
Instance Method Details
#finalize(collection) ⇒ Object
Called on the final collection after searching, ordering, arrayizing and formatting have been completed
6 7 8 |
# File 'app/models/effective/effective_datatable/hooks.rb', line 6 def finalize(collection) # Override me if you like collection end |
#order_column(collection, table_column, direction, sql_column_or_array_index) ⇒ Object
Override this function to perform custom ordering on a column direction will be :asc or :desc
21 22 23 24 25 26 27 |
# File 'app/models/effective/effective_datatable/hooks.rb', line 21 def order_column(collection, table_column, direction, sql_column_or_array_index) if table_column[:array_column] array_tool.order_column_with_defaults(collection, table_column, direction, sql_column_or_array_index) else table_tool.order_column_with_defaults(collection, table_column, direction, sql_column_or_array_index) end end |
#search_column(collection, table_column, search_term, sql_column_or_array_index) ⇒ Object
Override this function to perform custom searching on a column
11 12 13 14 15 16 17 |
# File 'app/models/effective/effective_datatable/hooks.rb', line 11 def search_column(collection, table_column, search_term, sql_column_or_array_index) if table_column[:array_column] array_tool.search_column_with_defaults(collection, table_column, search_term, sql_column_or_array_index) else table_tool.search_column_with_defaults(collection, table_column, search_term, sql_column_or_array_index) end end |