0.0
No commit activity in last 3 years
No release in over 3 years
Saving page lengths, search values, etc.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

Runtime

~> 3.2
 Project Readme

Gem Version

DatatableState

Installation

Add this line to your application's Gemfile:

gem 'datatable_state'

Then execute:

bundle

Copy migrations and run them:

rake datatable_state:install:migrations
rake db:migrate

Add routes:

# config/routes.rb
mount DatatableState::Engine => "/datatable_states"

Add helpers:

# app/controllers/application_controller.rb
helper DatatableState::ApplicationHelper

Javascripts:

//app/assets/javascripts/application.js
//= require datatable_state/store

Insert callbacks and utilites into DataTables definition:

{
  ...
  "pageLength": datatableStateDefaultPageLength(),
  "stateLoadCallback": datatableStateLoad,
  "stateSaveCallback": datatableStateSave,
  "stateSaveParams": datatableStateSkipPerColumn,
  ...
}

Use saved_display_length helper with server-side datatable

<table class="datatable datatable_ajax" ... <%= saved_display_length %>>