jQWidgets Forums

jQuery UI Widgets Forums Plugins Validator, Drag & Drop, Sortable jqxDragDrop selected item

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 11 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • jqxDragDrop selected item #26901

    dchauhan
    Participant

    How do I get the value of the item that is being dragged? I tried event.args.item.label and that doesn’t work.

    Here is my code. I want to know the value of the column that is being dragged:

    $(‘#’+cName+counterReportHeader).jqxDragDrop({
    restricter: ‘#reportHeader’,
    theme: ‘fresh’
    });

    $(‘#’+cName+counterReportHeader).bind(‘dragEnd’, function (event) {

    alert(event.toSource());
    var cX=event.args.position.left ;
    var cY=event.args.position.top ;
    alert(cX+”:”+cY); // THIS WORKS
    var item=event.args.item.label ; // THIS DOESNT WORK I need to know the value of the column that im moving
    alert(item);
    });

    jqxDragDrop selected item #26902

    Peter Stoev
    Keymaster

    Hi dchauhan,

    There is no such thing as “event.args.item.label” in jqxDragDrop. This sample shows how to manipulate the Dragged Objects, store information and do something when you drop it – http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdragdrop/defaultfunctionality.htm?web

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    jqxDragDrop selected item #26903

    dchauhan
    Participant

    So how do I know which object I am dragging?

    jqxDragDrop selected item #26904

    Peter Stoev
    Keymaster

    Hi dchauhan,

    In the sample I pointed you in the previous post, take a look at the “dragStart” event handler. When drag operation has started, the information about the Dragged object is stored in the jqxDragDrop’s ‘data’ property.

      $('.draggable-demo-product').bind('dragStart', function (event) {
    var tshirt = $(this).find('.draggable-demo-product-header').text(),
    price = $(this).find('.draggable-demo-product-price').text().replace('Price: $', '');
    $('#cart').css('border', '2px solid #aaa');
    price = parseInt(price, 10);
    $(this).jqxDragDrop('data', {
    price: price,
    name: tshirt
    });
    });

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.