derekcroft / zable

HTML table generation with searching and sorting made dead simple

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extra params use case?

joekur opened this issue · comments

I was wondering what kind of use case you were thinking of with the additional params you can pass into the zable helper

zable(@users, params: {something: 'blahblah'}) do
end

You're using these to append to the header links, and you were passing them to the will_paginate renderer I imagine to append to those links as well.

It seems like if we're talking default sort/search, this is something that would be done at the controller or model level.

Say you do a search on name, so you go to a page filtered by name:

http://hithere.io/items?search[name]=spoon

Now you want to sort the filtered search results, so when you click on one of the column headers, you don't want to lose the search you've already done. You need to go to:

http://hithere.io/items?search[name]=spoon&sort[attr]=price&sort[order]=desc

That's why the extra params are passed into the zable helper, so it can preserve all the existing parameters when it creates each link.