I just discovered that paging works fine when I order by a column. It looks like the paging code for MS-SQL uses the TOP function twice, sorting ascending on one, and descending on the other. But if I don't specify an order-by, it isn't able to reverse the sort to get the appropriate results.
So it kinda works, but not well enough to be useful in general. Is this a bug I need to talk to the will-paginate people about, or is it a hobo issue? Do you guys have any better ability to talk to the will-paginate guys? A great article I found on alternative ways to paginate is at http://www.codeproject.com/KB/database/PagingResults.aspx Steve. -- Steve Van Bruwaene International Teams Canada Special Projects [email protected] http://www.vanbruwaene.ca "Developing Resources that help IT Canada be More Effective in its Mission." IT Canada: 519-669-8844, 1 Union St., Elmira, ON, N3B 3J9 IT US: 847-429-0900, 411 West River Road, Elgin, IL 60123, USA On Mon, Jul 13, 2009 at 11:55 AM, Steve Van Bruwaene <[email protected]>wrote: > Did some more digging, and the parameters do seem to be being passed. The > generated SQL is just not doing the right thing. > > When I request page 5, In the debug log, I see the query: > SELECT * FROM (SELECT TOP 30 * FROM (SELECT TOP 150 * FROM [Folder] ) AS > tmp1) AS tmp2 > > So it's got some pagination stuff in there. Unfortunately the code > generated for my database (MS-SQL) doesn't produce useful results. -- it's > always the first page. > > Any idea how I could get the pagination code to work on my db? > > Thanks! > > Steve. > > -- > Steve Van Bruwaene > International Teams Canada > Special Projects > [email protected] > http://www.vanbruwaene.ca > "Developing Resources that help IT Canada be More Effective in its > Mission." > > IT Canada: 519-669-8844, 1 Union St., Elmira, ON, N3B 3J9 > IT US: 847-429-0900, 411 West River Road, Elgin, IL 60123, USA > > > > On Fri, Jul 10, 2009 at 3:12 PM, kevinpfromnm <[email protected]>wrote: > >> >> That's odd, you might want to debug and see what's coming back from >> the controller as well as what's going up to it as the params. Easy >> way to do that in the views is something like <%= h object.inspect %> >> or a raise object.inspect where object is the item you want a closer >> look at so maybe a this.inspect before the collection for instance. >> >> On Jul 10, 11:22 am, Steve Van Bruwaene <[email protected]> wrote: >> > Here's what I have: >> > >> > Controller: >> > >> > class FoldersController < ApplicationController >> > >> > hobo_model_controller >> > >> > auto_actions :all >> > >> > end >> > >> > index.dryml >> > <index-page> >> > <collection: replace> >> > <table-plus fields="this, Type, LastGiftDate"> >> > <empty-message:>No folders match your >> criteria</empty-message:> >> > </table-plus> >> > </collection:> >> > </index-page> >> > >> > the pagination bar comes up, when I click a link, it loads, but the >> > table-plus part of the page had the same data no matter what page is >> > requested. >> > >> > Thanks for the help! >> > >> > Steve. >> > >> > On Fri, Jul 10, 2009 at 12:01 PM, kevinpfromnm <[email protected] >> >wrote: >> > >> > >> > >> > > You haven't changed the controller at all? That's odd since I've done >> > > the same sort of thing and had pagination work fine (only dozens of >> > > records, not thousands but should still work the same). Can you post >> > > your changed code? >> > >> > > On Jul 10, 7:04 am, Steve VanB <[email protected]> wrote: >> > > > I'm trying to get table-plus to work on a table that has thousands >> of >> > > > records. Obviously I don't want to show them all, but pagination to >> > > > be able to get through more than one page of them could be nice. >> > >> > > > When I put table-plus in an index page with noting special on the >> > > > controler, I get the table and a pagination thing like I would have >> > > > with the default cards list. Unfortunately, when I go to other >> pages, >> > > > table-plus still just lists the first 20 records (or what ever the >> > > > number is). It seems the page info isn't passed allong to >> table-plus. >> > >> > > > How do I get this to happen on the index page? >> > >> > > > Thanks! >> > >> > > > Steve. >> >> >> > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/hobousers?hl=en -~----------~----~----~----~------~----~------~--~---
