Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

will_paginate with jqgrid #121

Open
ndemoreau opened this issue Apr 4, 2011 · 0 comments
Open

will_paginate with jqgrid #121

ndemoreau opened this issue Apr 4, 2011 · 0 comments

Comments

@ndemoreau
Copy link

I'm trying to sort my jqgrid like this:

def index
tup = SmartTuple.new(" AND ")
tup << ["firstname like ?", "%#{params[:firstname]}%"] if params[:firstname].present?
tup << ["lastname like ?", "%#{params[:lastname]}%"] if params[:lastname].present?
tup << ["email like ?", "%#{params[:email]}%"] if params[:email].present?
tup << ["function like ?", "%#{params[:function]}%"] if params[:function].present?
users = User.find(:all, :conditions => tup.compile).paginate :page => params[:page], :per_page => params[:rows], :order => params[:sixd]

respond_to do |format|
  format.html
  format.json { render :json => users.to_jqgrid_json([:id,:firstname,:lastname,:email,:function],
                                                     params[:page], params[:rows], users.total_entries) }
end

end

The page parameters are correctly applied but it doesn't sort the way it should.

What can be wrong?

My querystring is following one:

{"q"=>"1", "_search"=>"false", "nd"=>"1301936699853", "rows"=>"10", "page"=>"1", "sidx"=>"firstname", "sord"=>"asc"}

Thanks,

Nicolas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant