No commit activity in last 3 years
No release in over 3 years
acts_as_flexigrid is ActiveRecord plugin for Flexigrid
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.0.0
>= 0
>= 0

Runtime

 Project Readme

acts_as_flexigrid¶ ↑

ActiveRecord plugin to use easily Flexigrid that is jQuery plugin for grid table

Installation¶ ↑

gem install acts_as_flexigrid

How to use¶ ↑

  1. Download Flexigrid from flexigrid.info/ and place javascript and css files.

  2. Include to models

class Site < ActiveRecord::Base
  include ActsAsFlexigrid
end
  1. Get json response for Flexigrid

class SitesController < ApplicationController

  def index
    @sites = Site.where({...})
    respond_to do |format|
      format.html
      format.json do
        if params.delete(:flexigrid).present?
          @site = @sites.flexigrid(params)
        end
        render :json => @sites
      end
    end

    ...
  1. Set javascript and view

application.js

$("#sites-grid").flexigrid({
  method: "GET",
  url: "/sites.json?flexigrid=true",
  dataTyep: "json",
  colModel: [
    {display: 'Name', name: 'name, sortable: true},
    ...
  ],
  searchitems: [
    {display: "Name", name: 'name, isdefault: true},
    ....
  ],
  sortname: "name",
  sortorder: "asc",
  usepager: true,
  rp: 10
})

view / app/views/sites/index.html.erb

<div id="sites-grid"></div>

Copyright © 2011 Akihiro Matsumura. See LICENSE for details.