omines / datatables-bundle

DataTables bundle for Symfony
https://omines.github.io/datatables-bundle/
MIT License
263 stars 113 forks source link

Update datatables.js #29

Closed biji closed 6 years ago

biji commented 6 years ago

fix path gone

curry684 commented 6 years ago

Eya, thanks for the PR 👍

I'm just not entirely sure what the PR is solving. history.replaceState documentation states:

The new URL does not need to be absolute; if it's relative, it's resolved relative to the current URL.

This makes the current code valid - it's pushing states like #state=1 and ?state=2 explicitly to preserve all existing higher elements, and they are valid URLs.

I even think the PR would break use cases where the originating page and the table renderer are not on the same URL, as you'd be pushing the data URL onto the history in this case, explicitly breaking the browser history.

biji commented 6 years ago

In my case url is http://localhost:8000/menu/listing , but when sorting columns url become: http://localhost:8000/#order[0][]=3&order[0][]=desc missing /menu/listing parts

curry684 commented 6 years ago

I have no clue why that would happen. If on this very Github page you open the devconsole (F12) and run history.replaceState(null, 1, "#test"), what does the URL in the address bar become? For me it correctly ends up on https://github.com/omines/datatables-bundle/pull/29#test.

biji commented 6 years ago

Looks like because my projects contains base href like <base href="http://localhost:8000">

curry684 commented 6 years ago

Uhm yeah but that breaks most external libraries, not just ours. In general <base> causes more issues than it fixes.

curry684 commented 6 years ago

Closed in favor of #35