I'm looking at the Mockup sortable pattern, I'd like to add a callback function.
According to the docs I just need to assign a callback function to "drop" inside of the data-pat-sortable property.
http://plone.github.io/mockup/dev/#pattern/sortable
So I did this:
<table data-pat-sortable="selector:tr;
drop:reorderStatusAlerts;
dragClass:dragging;"
class="listing table-stripped pat-sortable">
<tr><td>my thing</td></tr>
<tr><td>my other thing</td></tr>
</table>
I have a simple function that looks like this (just for testing).
<script>
function reorderStatusAlerts(event){
console.log(event);
}
</script>
I figured the callback would trigger some useful information on the console.
Dragging works, the selector and dragClass work as expected, but the callback doesn't, what I get as output on the console is the following error:
logged-in.js:24 Uncaught TypeError: b.options.drop is not a function
at HTMLTableRowElement.<anonymous> (logged-in.js:24)
at HTMLTableRowElement.dispatch (jquery.min.js:3)
at HTMLTableRowElement.b.dispatch (default.js:2531)
at HTMLTableRowElement.<anonymous> (default.js:2531)
at Function.each (jquery.min.js:2)
at n.fn.init.each (jquery.min.js:2)
at Object.hijack (default.js:2531)
at HTMLDocument.handler (default.js:2531)
at HTMLDocument.dispatch (jquery.min.js:3)
at HTMLDocument.b.dispatch (default.js:2531)
(anonymous) @ logged-in.js:24
dispatch @ jquery.min.js:3
b.dispatch @ default.js:2531
(anonymous) @ default.js:2531
each @ jquery.min.js:2
each @ jquery.min.js:2
hijack @ default.js:2531
handler @ default.js:2531
dispatch @ jquery.min.js:3
b.dispatch @ default.js:2531
r.handle @ jquery.min.js:3
I'm really not sure what I'm missing at this point.