jQWidgets Forums

jQuery UI Widgets Forums Lists ListBox Determining the location of a drop when dragging items

This topic contains 2 replies, has 2 voices, and was last updated by  David McNamara 12 years, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • I have a situation where I want to be able to drag and drop items between two listboxes.

    However, due to the complexity of the items within the listboxes, I have to perform some additional processing on the items within the drop target and therefore need to handle the ‘drop’ action myself. To achieve this I have set the dropAction on the target listbox to ‘none’.

    The problem I have is that I don’t seem to be able to locate any information within the dragEnd’s event parameter that tells me where the drop action occurred. While there is coordinate information for the location of the drop, and I could use that in conjunction with the listbox items’ left, top, width and height properties to work out what item was under the drop location, this will not work if the listbox has been scrolled.

    Am I missing some information in the event structure that provides the drop target information? Alternatively, is there some way that I can determine what the relative coordinate of the top of the visible part of the scrolled listbox is?

    Regards,
    David.


    Peter Stoev
    Keymaster

    Hi David,

    You can get the scrolling location of the ListBox by getting the values of the horizontal and vertical scrollbars.

    var vValue = $("#listBoxA").jqxListBox('vScrollBar').jqxScrollBar('value');
    var hValue = $("#listBoxA").jqxListBox('hScrollBar').jqxScrollBar('value');

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Thanks Peter, that works perfectly.

    Regards, David.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.