Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. (function(){
  2. $('#bags_table tr').click(function() {
  3. alert(1)
  4. alert($(this).attr('id')); //trying to alert id of the clicked row
  5.  
  6. });
  7. });
  8.  
  9. function bags_table_func(result){
  10.  
  11. var rows = "<tr><th>Seal No.</th><th>Status</th><th>Destination</th><th>Total Packets</th><th>Max. Weight</th>" +
  12. "<th>Min. Weight</th><th>Avg. Weight</th><th>Total Weight</th></tr>"
  13.  
  14. for (var obj in result){
  15. if (obj == 'last_bagged_on'){
  16. continue
  17. }
  18. else if (result[obj]['status'] == undefined){
  19. rows += "<tr><td>No Content</td></tr>"
  20. break
  21. }
  22. rows += "<tr id = '"+obj+"'><td>" + obj+"</td><td>" + result[obj]["status"] + "</td><td>" +
  23. result[obj]["destination"] + "</td><td>" + result[obj]["total_packets"] + "</td><td>" +
  24. result[obj]["max_weight"] + "</td><td>" + result[obj]["min_weight"] + "</td><td>" +
  25. result[obj]["avg_weight"] + "</td><td>" + result[obj]["total_weight"] + "</td><td><a href = '#'>Details</td></tr>"
  26. }
  27. $("#bags_table").html(rows);
  28. }
  29.  
  30. $(document).on('click','#bags_table tr',function() {
  31. alert(1)
  32. alert($(this).attr('id')); //trying to alert id of the clicked row
  33. });
  34.  
  35. $(document.body).on('click','#bags_table tr',function () {
  36. alert(1)
  37. alert($(this).attr('id')); //trying to alert id of the clicked row
  38. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement