leikind / wice_grid

A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters
MIT License
537 stars 215 forks source link

Absolute url is not generating for Order header. #252

Closed bhushangahire closed 8 years ago

bhushangahire commented 8 years ago

Rails : 4 Wice Grid : 3.5.0

I am using wice grid on rails 4 app and I have simple wice grid setup for users model but when I go to http://localhost:3000/users list loads perfectly, filter also works fine. But when I click to sort column its taking url as http://localhost:3000?order parameters. Its skipping /users any idea whats going wrong?

leikind commented 8 years ago

can you post HTML source code for the first table columns?

bhushangahire commented 8 years ago
<thead><tr class="wice-grid-title-row"><th class=" sorted"><a class="asc" href="?users%5Border%5D=first_name&amp;users%5Border_direction%5D=desc">First Name</a></th><th class=""><a href="?users%5Border%5D=last_name&amp;users%5Border_direction%5D=asc">Last Name</a></th><th class=""><a href="?users%5Border%5D=email&amp;users%5Border_direction%5D=asc">Email</a></th><th class=""><a href="?users%5Border%5D=username&amp;users%5Border_direction%5D=asc">Username</a></th><th class="">Roles</th><th class=""></th></tr><tr class="wg-filter-row" id="users_filter_row"><th class="sorted sorted"><input class="form-control input-sm " id="users_f_first_name" name="users[f][first_name]" size="8" type="text" value=""></th><th class=""><input class="form-control input-sm " id="users_f_last_name" name="users[f][last_name]" size="8" type="text" value=""></th><th class=""><input class="form-control input-sm " id="users_f_email" name="users[f][email]" size="8" type="text" value=""></th><th class=""><input class="form-control input-sm " id="users_f_username" name="users[f][username]" size="8" type="text" value=""></th><th class=""><div class="custom-dropdown-container"><select class="custom-dropdown form-control" id="users_f_roles_name" name="users[f][roles.name][]"><option selected="selected" value="">--</option>
<option value="sales">Sales</option>
<option value="manager">Manager</option>
<option value="accountant">Accountant</option>
<option value="admin">Admin</option></select><span class="expand-multi-select-icon clickable" title="Expand"></span><span class="collapse-multi-select-icon clickable" style="display: none" title="Collapse"></span></div></th><th class=" filter_icons"><div class="submit clickable" id="users_submit_grid_icon" title="Filter"></div> <div class="reset clickable" id="users_reset_grid_icon" title="Reset"></div></th></tr></thead>
bhushangahire commented 8 years ago

As of not I have updated href using javascript

$(".grid_headers > th > a").each(function(index, value){
    url = location.pathname + $(value).attr("href");
    $(value).attr("href", url);
  });
leikind commented 8 years ago

A link starting with "?" is totally fine. It means going to the same current url path.

bhushangahire commented 8 years ago

But its redirecting to Root url.

leikind commented 8 years ago

what's the current URL, and what does the browser show in the status bar when you hover about the order link?

bhushangahire commented 8 years ago

Browser shows localhost:3000/users. and on hover it shows localhost:3000?grid and params. It does not take users.

leikind commented 8 years ago

Have a look at this page and its source: http://leikind.org/users/

There is something else you are missing. What you say contradicts the way browsers work