patricklindsay / wice_grid

A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters
http://wicegrid.herokuapp.com/
MIT License
33 stars 29 forks source link

"Show all" and "back to paginated view" should have href attribute #55

Open JasonBarnabe opened 5 years ago

JasonBarnabe commented 5 years ago

The links to sort columns and paginate all have href attributes. "Show all" and "back to paginated view" do not. This makes it harder to do custom behaviour like have the grid update dynamically.

These links should have href attributes.

patricklindsay commented 5 years ago

Not entirely sure what you mean by this, can you provide code samples?

JasonBarnabe commented 5 years ago

Sortable column header links have code like this:

<a class="asc" href="?grid%5Border%5D=created_at&amp;grid%5Border_direction%5D=desc">Signup Date <i class="fa fa-arrow-down"></i></a>

So if I want, I can hook up some JS to this link and dynamically rewrite the grid to avoid a page load.

A "show all" link, on the other hand, has no usable href attribute and relies on wice_grid's JS to work:

<a href="#" title="Show all records" class="wg-show-all-link" data-grid-state="[[&quot;grid[order]&quot;,&quot;created_at&quot;],[&quot;grid[order_direction]&quot;,&quot;asc&quot;],[&quot;grid[pp]&quot;,8593]]" data-confim-message="Are you sure you want to display all records?">show all</a>

If the "show all" link had a proper href attribute like the column headers do, then I could use my custom JS with it.