Sha256: e56ce15282bc78ae57e033dadd69d6c8ce5d126f3de4ab91b761b51ca787f91d

Contents?: true

Size: 293 Bytes

Versions: 3

Compression:

Stored size: 293 Bytes

Contents

# frozen_string_literal: true

class DatatableCondProc < ComplexDatatable
  def view_columns
    super.deep_merge(username: { cond: custom_filter })
  end

  private

  def custom_filter
    ->(column, value) { ::Arel::Nodes::SqlLiteral.new(column.field.to_s).matches("#{value}%") }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ajax-datatables-rails-1.5.0 spec/support/datatables/datatable_cond_proc.rb
ajax-datatables-rails-1.4.0 spec/support/datatables/datatable_cond_proc.rb
ajax-datatables-rails-1.3.1 spec/support/datatables/datatable_cond_proc.rb