Using the JQueryUI Sortable (version 1.12.1) method in a TypeScript (version 3.2.1) environment has mostly been smooth sailing for me. However, I've hit a roadblock while trying to implement the Sortable Widget's helper
option. Here's a snippet of my TypeScript code:
$('.connected-sortable').sortable({
connectWith: '.connected-sortable',
delay: 150,
helper: (evt: Event, item: JQueryUI.Sortable) => {
// How can I interact with the JQueryUI.Sortable object?
// I need access to a JQuery<HTMLElement> or just an
// Element to manipulate.
// The following attempt fails:
// Property 'hasClass' does not exist on type 'Sortable'
item.addClass('selected');
}
});
I'm struggling to treat the JQueryUI.Sortable
object like a JQuery<HTMLElment>
or even a plain HTML Element
. My JavaScript version of this code is based on this Fiddle.
If anyone could offer guidance on how to achieve this, I'd greatly appreciate it. Thank you.