Drag and Drop div into table and get the data value
===

I set the div data value in table cells, what I want is how to get the div data value, while drop.

In my code, I set the data in the table like this

      <script type="text/javascript">

     function createDynamicTable(tbody, rows, cols) {

          if (tbody == null || tbody.length < 1) return;

        for (var r = 1; r <= rows; r++) {

              var trow = $("<tr>");

             for (var c = 1; c <= cols; c++) {

                  var cellText = "Cell " + r + "." + c

                $("<td>")

                         .addClass("tableCell")

                          .text(cellText)

                         .data("col", c)

                         .appendTo(trow);

            }

             trow.appendTo(tbody);

         }

      }   

 </script>

 In my code, on clicking the cell of table, I get the row and column data div values


       $(document).ready(function() {
    
        createDynamicTable($("#tbl"), 10, 5);
    
         $("#tbl td.tableCell")
    
                 .click(function() {
    
                     alert("Clicked Col=" + $(this).data("col"));
    
                 });
    
     });

it is working perfectly

 for full code view the site:
<http://blogs.microsoft.co.il/blogs/linqed/archive/2009/03/04/generating-html-tables-with-jquery.aspx>

I try like this but I cann't getting the table cell data value on stop event. How to get the setted data value in drag and drop.

    $(".drag").draggable({
                   
                        stop: function (ev, ui) {
                            
                            var pos = $(ui.helper).offset();
                            var oldData = $("#tbl td.tableCell").data('col');
                            alert(oldData);
                            }
    });

Help me to get the data value in drag and drop.

Thanks in advance.



