Search code examples
jqueryjquery-ui-droppablesapui5

UI5 getting table rowIndex based on Mouse event x and y


i have to make a UI where i need to drag Item from List to Table

I followed this post and made drag and drop and it is working fine. But problem is i need to add to the exact row where user dropped.

How to find the rowIndex from the JQuery DropEvent


Solution

  • Insted of making table as droppable, we can make each row as droppable as below

    var tableId = this.oTable.getId();
    $("#"+tableId+" tr").droppable({  
        drop: this.onDroped.bind(this) 
    });
    

    So we can catch exact row where it is dopped, then we can decide where we can add the droped data.