Skip to content
This repository was archived by the owner on Dec 3, 2021. It is now read-only.

Add beforeToggle callback ? #75

Open
xhuberdeau opened this issue Sep 3, 2015 · 0 comments
Open

Add beforeToggle callback ? #75

xhuberdeau opened this issue Sep 3, 2015 · 0 comments

Comments

@xhuberdeau
Copy link

Hi,
Would it be possible to add a callback before the switch is toggled ?
Currently, I load data via Ajax from a DB. There is an boolean attribute for each line of this data, which is the model for each toggle switch. My use case is :
When you click on the toggle, it updates the attribute in DB. My problem is that the toggle is switched before the ajax request is done. In case of a servor error, the toggle is switched let's say to "yes", the ajax return an error, the toggle is switched back to "no".

I'd like to wait for the ajax response before any switch happens. How would you do that ? Watching my data is not useful there.

Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant