Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.
/ u_order-rails Public archive

customizable table ordering gem ( js,jquery + ActiveRecord )

License

Notifications You must be signed in to change notification settings

m0gg/u_order-rails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UOrder

Current features

  • order by a single column/attribute

  • possibility to add your own callbacks on ordering

Dependencies

  • jruby-rails

  • jquery-ui-rails

Installation

  • Gemfile

    gem 'u_order', '~> 0.2', :git => 'https://github.com/m0gg/u_order-rails.git'
    
  • application.js

    //= require u_order

Usage

  • Identify a table to be ordered, data-table is an ordergroup name you may choose yourself, it’s independant of the actual table or collection.

    <table data-table="posts">
      <tr>
  • Ordermodes are controlled by the order-mode attribute. Default is +“single”+, +“multi”+ allows to order by more than one attribute, last clicked with highest priority. (since 0.3.a)

    <table order-mode="multi" data-table="posts">
  • Set the attribute to order with data-order, this one would order by title

    <th data-order="title">Title</th>
  • Ordercycles are controlled by the order-cycle attribute. Default is +“asc desc”+, there are 3 implemented cycles, asc, desc and none. If none is reached, the ordering on this head is removed.

    <th order-cycle="desc asc none" data-order="title">Title</th>
  • The last thing is to call the uorder method with chosen params on your ActiveRecord relation. The data-order attribute is prefixed with “uorder_”

    @posts = Post.uorder(params[:uorder_posts])
    

About

customizable table ordering gem ( js,jquery + ActiveRecord )

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published