22 Apr '12, 1am

#340 DataTables - RailsCasts:

class ProductsDatatable delegate :params, :h, :link_to, :number_to_currency, to: :@view def initialize(view) @view = view end def as_json(options = {}) { sEcho: params[:sEcho].to_i, iTotalRecords: Product.count, iTotalDisplayRecords: products.total_entries, aaData: data } end private def data products.map do |product| [ link_to(product.name, product), h(product.category), h(product.released_on.strftime("%B %e, %Y")), number_to_currency(product.price) ] end end def products @products ||= fetch_products end def fetch_products products = Product.order("#{sort_column} #{sort_direction}") products = products.page(page).per_page(per_page) if params[:sSearch].present? products = products.where("name like :search or category like :search", search: "%#{params[:sSearch]}%") end products end def page params[:iDisplayStart].to_i/per_page + 1 end def per_page params[:iDisplayLength].to...

Full article: http://railscasts.com/episodes/340-datatables?autoplay=true

Tweets

Watching DataTables on RailsCasts via @railscasts

railscasts.com 12 Apr '12, 2am

class ProductsDatatable delegate :params, :h, :link_to, :number_to_currency, to: :@view def initialize(view) @view = view ...

The first comment on this video made me LOL:

railscasts.com 25 Apr '12, 8pm

I have been using datatables since it first came out and rely on its features for all my statistical production sites. Eve...