vojtech-dobes / history.nette.ajax.js

Adds History API support to nette.ajax.js addon!
30 stars 27 forks source link

Option to prevent changing URL #5

Closed Maekoboss closed 10 years ago

Maekoboss commented 10 years ago

I would appreciate if I can decide weather the URL will be updated or not.

My scenario: I have ajax image gallery and each picture has delete icon (anchor with href to signal deleteImage!) hitting this button is properly ajax handled, image is deleted and snippet with gallery is redrawed and its fine but I ended up with URL containing &do=handleDeleteImage but I would like to have URL without this parameter. I can use redirect but I dont see any reason why.

vojtech-dobes commented 10 years ago

If you want some link to be ajaxified but not incorporate history's behavior, you can disable it like this:

<a data-ajax-off="history">
Maekoboss commented 10 years ago

Cool, sry for bothering than. I suggest to put this comment to the readme.

vojtech-dobes commented 10 years ago

Good idea :)

Dne čtvrtek 5. června 2014 Maekoboss notifications@github.com napsal(a):

Cool, sry for bothering than. I suggest to put this comment to the readme.

— Reply to this email directly or view it on GitHub https://github.com/vojtech-dobes/history.nette.ajax.js/issues/5#issuecomment-45235797 .

zraly commented 9 years ago

If I use data-ajax-off="history" on signal, it still redraws the content, maybe it shouldn't.

Signals are not supposed to refresh whole page. Signals should redraw a snippet or do stuff in background. So if I use this flag on signal, it should send just snippet I declare in handleSignal() method.

In my case, I need to remove item from a list. It is done by animation (the row disappears) and by signal (the row is removed from database in the background). But I don't want to redraw whole "content snippet" (because of animation).