Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. jQuery('#' + _target).each(function () {
  2.  
  3. var $table = jQuery(this);
  4. var i = 0;
  5. jQuery('th', $table).each(function (column) {
  6. if (jQuery(this).find("input")) {
  7. dataTypes[i] = { "sSortDataType": "input" }
  8. }
  9. else {
  10. dataTypes[i] = { "sSortDataType": "html" }
  11. }
  12.  
  13. i++;
  14. });
  15. });
  16.  
  17. dataTypes = $('#' + _target + ' th').map(function(i, th) {
  18. var $table = $(th).closest('table');
  19. var pos = $table.index(th) + 1;
  20. return { "sSortDataType": $table.find('td:nth-child('+pos+')').is(':has(input)') ? 'input' : 'html' };
  21. });
  22.  
  23. dataTypes = $('#' + _target + ' th').map(function(pos, th) {
  24. return { "sSortDataType": $(th).closest('table').find('td:nth-child('+(pos+1)+')').is(':has(input)') ? 'input' : 'html' };
  25. });
  26.  
  27. if (jQuery(this).is(":has(input)")) {
  28.  
  29. dataTypes = jQuery('th', $table).map(function () {
  30. if (jQuery(this).is(":has(input)"))
  31. return { "sSortDataType": "input" };
  32. else
  33. return { "sSortDataType": "html" };
  34. }).get();
  35.  
  36. var thMatches = $('#' + _target + ' th');
  37. var thCount = thMatches.length;
  38. var thCountWithInputs = thMatches.find('input').length;
  39.  
  40. jQuery('#' + _target).each(function () {
  41. var $table = jQuery(this);
  42. var i = 0;
  43. jQuery('th', $table).each(function (column) {
  44. if ($('tbody > tr').find('td:nth-child(' + (column+1) + ')')
  45. .has('input')
  46. .length) {
  47. dataTypes[i] = { "sSortDataType": "input" }
  48. }
  49. else {
  50. dataTypes[i] = { "sSortDataType": "html" }
  51. }
  52.  
  53. i++;
  54. });
  55. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement