Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Question about undocumented events (ui-sortable:moved) #539

Open
sneakyfildy opened this issue Oct 4, 2017 · 4 comments
Open

Question about undocumented events (ui-sortable:moved) #539

sneakyfildy opened this issue Oct 4, 2017 · 4 comments

Comments

@sneakyfildy
Copy link

sneakyfildy commented Oct 4, 2017

Hi. Why events like
ui-sortable:moved
are not documented.
The callbacks you suggest to use are called without any arguments (or I can't get how to have them).

ui-sortable-stop="u.onDrop($event, ui)"
doesn't bring any arguments into onDrop handler function. I've tried to inspect sources and didn't find any arguments insertion (except some "locals").

So. What are these undocumented events for and why "ui" arguments is not given into a callback function.
Thank you.

@thgreasi
Copy link
Contributor

thgreasi commented Oct 4, 2017

Regarding point 1, these events were contributed but I forgot to also open an issue regarding the docs.
PRs are welcome.

Regarding point 2, I think that it gets passed and we also have a test case for that,

@sneakyfildy
Copy link
Author

Thank you very much. Confirming arguments are sent correctly.
My handler setting was incorrect
This one is good
ui-sortable-stop="u.onDrop"

@sneakyfildy
Copy link
Author

sneakyfildy commented Oct 6, 2017

Erm. Is there a way to attach a context to this handler?

Oh yes, sure!
Just use sortable options object and make a binding inside:

opts = {
    stop: this.onDrop.bind(this)
}

@thgreasi
Copy link
Contributor

thgreasi commented Oct 6, 2017

👍

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

2 participants