<commit_before>= Simple Datatables

Connects two awesome plugins - Datatables for Jquery and Meta Search together for Rails 3.1

== Install

Add the following to your Gemfile to install simple datatables:

  gem 'simple_datatables'

After bundle install add this line to rails 3.1 assets pipeline and restart server:

  //= require simple_datatables

Installation completed.

== Description

There are two ways to map awesome Datatables plugin request fields for Rails.

* First is to convert request on the server side
* Second is to prepare correct request on the client side  

This gem provides interface for the second way. 
To use it you should do the following easy three steps:

Create simple meta_search and will_paginate (optionally) controller action as usual and add ".datatables" format

  respond_to :html, :datatables
  
  def search
    @products = Product.search(params[:search]).paginate(:page => params[:page], :per_page=>params[:per_page])
    respond_with @products
  end

Use standard datatables initializer options for creating table:

* bServerSide: true
* sAjaxSource: path to your controller
* fnServerData: point to simpleDatatables function
* aoColumns: you *should* define all searchable/fiterable sName attributes here. Use format as used in meta_search (with underscores) 

Create Jsonify view with column values for columns listed in aoColumns. See example for clarification.

This gem uses:
* meta_search for nice search and sort request syntax mapping
* jsonify for simple output generation 

This gem provides integration with:
* will_paginate for nice pagination request syntax mapping

Gem works only with rails 3.1.

Gem includes datatables library and fnSetFilteringDelay plugin so you haven't include it by yourself.

== Pagination

Simple_datatables is compatible with will_paginate. Datatables will provide you "page" and "per_page" request params.

If you do not use pagination do not forget to save search result to some variable with meta_search relation method:

  @products = Product.search(params[:search]).relation

== Search for all fields

Note that fulltext search will work only with text fields due to meta_search restrictions. To prevent errors use bSearchable: false for non-text columns in aoColumns field.

== Regex search

Due to meta_search restrictions it is impossible to use regex search for now.

Instead, this gem recognizes bSearch flag as "contains" meta_search finder.
<commit_msg>- update read me<commit_after>= Simple Datatables for Kaminari

This fork works with kaminari gem!

Connects two awesome plugins - Datatables for Jquery and Meta Search together for Rails 3.1

== Install

Add the following to your Gemfile to install simple datatables:

  gem 'simple_datatables'

After bundle install add this line to rails 3.1 assets pipeline and restart server:

  //= require simple_datatables

Installation completed.

== Description

There are two ways to map awesome Datatables plugin request fields for Rails.

* First is to convert request on the server side
* Second is to prepare correct request on the client side  

This gem provides interface for the second way. 
To use it you should do the following easy three steps:

Create simple meta_search and kaminari (optionally) controller action as usual and add ".datatables" format

  respond_to :html, :datatables
  
  def search
    @products = Product.search(params[:search]).page(params[:page]).per(params[:per_page])
    respond_with @products
  end

Use standard datatables initializer options for creating table:

* bServerSide: true
* sAjaxSource: path to your controller
* fnServerData: point to simpleDatatables function
* aoColumns: you *should* define all searchable/fiterable sName attributes here. Use format as used in meta_search (with underscores) 

Create Jsonify view with column values for columns listed in aoColumns. See example for clarification.

This gem uses:
* meta_search for nice search and sort request syntax mapping
* jsonify for simple output generation 

This gem provides integration with:
* will_paginate for nice pagination request syntax mapping

Gem works only with rails 3.1.

Gem includes datatables library and fnSetFilteringDelay plugin so you haven't include it by yourself.

== Pagination

Simple_datatables is compatible with Kaminari. Datatables will provide you "page" and "per_page" request params.

If you do not use pagination do not forget to save search result to some variable with meta_search relation method:

  @products = Product.search(params[:search]).relation

== Search for all fields

Note that fulltext search will work only with text fields due to meta_search restrictions. To prevent errors use bSearchable: false for non-text columns in aoColumns field.

== Regex search

Due to meta_search restrictions it is impossible to use regex search for now.

Instead, this gem recognizes bSearch flag as "contains" meta_search finder.

{'fraction_non_alphanumeric': 0.0459349593495935, 'fraction_numerical': 0.0024390243902439024, 'mean_word_length': 4.748831775700935, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7164998', 'n_tokens_mistral': 1285, 'n_tokens_neox': 1241, 'n_words': 647}