Sha256: 4866b5a652bd8017e2b48f33d5a3b2a84a5dac6d74713fcb2a1cc2ff379c8c64

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

class OrdersIndex < Datatable::Base

  sql <<-SQL
      SELECT
        orders.id,
        orders.order_number,
        customers.first_name,
        customers.last_name,
        orders.memo
      FROM
        orders
      JOIN
        customers ON customers.id = orders.customer_id
  SQL

  columns(
    {"orders.id" => {:type => :integer, :sTitle => "Id", :sWidth => '50px'}},
    {"orders.order_number" => {:type => :integer, :link_to => link_to('{{1}}', order_path('{{0}}')),:sTitle => 'Order Number', :sWidth => '125px'  }},
    {"customers.first_name" => {:type => :string, :link_to => link_to('{{2}}', order_path('{{0}}')),:sWidth => '200px' }},
    {"customers.last_name" => {:type => :string,:sWidth => '200px'}},
    {"orders.memo" => {:type => :string }}
  )
  option('individual_column_searching', true)
  #option('sDom', '<"H"lrf>t<"F"ip>')    # use with pagination
  
  # to use pagination comment out following and enable previous line
  option('sDom', '<"clear"><"H"Trf>t<"F"i>')
  option('bScrollInfinite', true)
  option('bScrollCollapse', true)
  option('sScrollY', '200px')
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
datatable-0.1.1alpha4 example_app/app/datatables/orders_index.rb
datatable-0.1.1alpha1 example_app/app/datatables/orders_index.rb
datatable-0.1.0alpha2 example_app/app/datatables/orders_index.rb