ui-sortable icon indicating copy to clipboard operation
ui-sortable copied to clipboard

Question about undocumented events (ui-sortable:moved)

Open sneakyfildy opened this issue 8 years ago • 4 comments

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.

sneakyfildy avatar Oct 04 '17 14:10 sneakyfildy

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,

thgreasi avatar Oct 04 '17 14:10 thgreasi

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

sneakyfildy avatar Oct 04 '17 15:10 sneakyfildy

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)
}

sneakyfildy avatar Oct 06 '17 10:10 sneakyfildy

👍

thgreasi avatar Oct 06 '17 14:10 thgreasi