Closed fabriciofreitag closed 5 years ago
anchor
is not passed to backend by the HTTP standard. So the link that retain anchor can not be generated because backend doesn't know about it.
You can simulate the behavior only using JavaScript.
Try something like this:
jQuery(function() {
jQuery('.datagrid-reset').each(function(i, element) {
jQuery(element).attr('href', jQuery(element).attr('href') + window.location.hash);
});
});
@bogdan thanks for the quick reply. but then why the filtering (search button) works as expected when there's an anchor(keeping the selected tab) while reset sends me to the previous page?
I can not confirm that. On my end, anchor vanishes for both Reset and Search buttons.
If an URL with an anchor (i.e: "/books/1#readers") is passed to
datagrid_form_for
The ancor is disregarded by the reset button:
<a class="datagrid-reset button" href='/books/1'>Reset</a>
Expected:
<a class="datagrid-reset button" href='/books/1#readers'>Reset</a>