tablesorter causes loss in div scroll overflow-y

tablesorter causes loss in div scroll overflow-y

Hi folks. I just started using jquery.tablesorter and it will help us a lot with our db stats page. One problem I'm running into is that when we use tablesorter we lose the overflow-y:scroll and height:55% styles to our divs. I've tried inline styling as well as having the style in the header with the !important tag. Neither seems to work. If anyone knows of a way to get this to work I'd really appreciate the knowledge. I'm not a very good web dev and I just can't figure it out. Thanks!!

  1. <?PHP
  2. #Log in
  3. //<link rel="stylesheet" href="http://www.wordspionagedb.com/stats/tablesorter/themes/blue/style.css" type="text/css" media="print, projection, screen" />
  4. //<link rel="stylesheet" href="css/jq.css" type="text/css" media="print, projection, screen" />
  5. $header = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  6. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
  7. $header .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
  8. <head>
  9. <title>Wordspionage Stats</title>
  10. <script type="text/javascript" src="http://www.wordspionagedb.com/stats/tablesorter/jquery-latest.js"></script>
  11. <script type="text/javascript" src="http://www.wordspionagedb.com/stats/tablesorter/jquery.tablesorter.js"></script>
  12. <script type="text/javascript">
  13. $(function() {
  14. $("#user_table").tablesorter();
  15. });
  16. </script>';
  17. $header .= '<style>
  18. p , body
  19. {
  20. font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
  21. }
  22. #main
  23. {
  24. overflow-y:scroll !important; 
  25. height:55% !important;
  26. }
  27.     
  28. #user_table , #totals , #head_table , #totals_au
  29. {
  30. font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
  31. border-collapse:collapse;
  32. }
  33. #user_table td, #user_table th , #head_table th
  34. {
  35. font-size:1em;
  36. border:2px solid black;
  37. padding:3px 7px 2px 7px;
  38. text-align:center;
  39. }
  40. #totals th , #totals td
  41. {
  42. font-size:1em;
  43. border:0px solid black;
  44. padding:3px 7px 2px 7px;
  45. text-align:left;
  46. }
  47. #total_au , #totals_au th , #totals_au td
  48. {
  49. font-size:1em;
  50. padding:3px 7px 2px 7px;
  51. text-align:center;
  52. }
  53. #user_table th , #head_table th
  54. {
  55. font-size:1.1em;
  56. padding-top:5px;
  57. padding-bottom:4px;
  58. background-color:#404040 ;
  59. color:#ffffff;
  60. }
  61. #container{width:auto;height:auto;position:relative;}

  62. .column_n {
  63. width: 40%;
  64. float: left;
  65. position:relative;
  66. }

  67. </style>';
  68. $header .= '</head>
  69. <body>';
  70. echo $header;
  71. echo '<div id="main">';
  72. echo '<table id="user_table" class="tablesorter"><thead><tr><th>Codename</th><th>Level</th><th>Skill Points</th><th>Last Login</th><th>Active Games</th><th>Games Played</th>
  73. <th>Won</th><th>WS Balance</th><th>Purchases</th><th>Value</th><th>Best Game Score</th><th>Best Word Score</th><th>Best Move Score</th><th>MW Played</th></tr></thead><tbody>';
  74. $mostActiveCount = 0;
  75. $mostActiveName = '';
  76. $mostWonCount = 0;
  77. $mostWonName = '';
  78. $mostSpentCount = 0;
  79. $mostSpentName = '';
  80. $mostXPCount = 0;
  81. $mostXPName = '';
  82. $totalSales = 0;
  83. date_default_timezone_set('America/New_York');
  84. $serverTime = time();
  85. $numUsers = 0;
  86. while($numUsers < 10)
  87. {
  88. $showRow = 1;
  89. $activeGames = rand(1,20);
  90. $numUsers++;
  91. $level = 'Recruit';
  92. $lastTime = date('M-d  H:i' , 1392246813);
  93. $timeTest = 1392246813;
  94. $totalGames = rand(50,100);

  95. $totalPurchaseCount = 10;
  96. $value = 1 * 0.99 + 2 * 2.99 + 3 * 5.99 + 4 * 1.99;
  97. $totalSales = $totalSales + $value;

  98. $codeName = 'Sean'.rand(1,100);
  99. if ($totalGames > $mostActiveCount)
  100. {
  101. $mostActiveCount = $totalGames;
  102. $mostActiveName = $codeName;
  103. }
  104. $wins = rand(10,80);
  105. if ($wins > $mostWonCount)
  106. {
  107. $mostWonCount = $wins;
  108. $mostWonName = $codeName;
  109. }
  110. if ($value > $mostSpentCount)
  111. {
  112. $mostSpentCount = $value;
  113. $mostSpentName = $codeName;
  114. }
  115. $xp = rand(100,1000);
  116. if ($xp > $mostXPCount)
  117. {
  118. $mostXPCount = $xp;
  119. $mostXPName = $codeName;
  120. }
  121. if (($serverTime - $timeTest > 1209600) AND $activeGames == 0 AND $totalPurchaseCount == 0)
  122. {
  123. }
  124. else
  125. {
  126. //table data
  127. $table = '';
  128. $table = '<tr>';
  129. $table .= '<td>'.$codeName.'</td>';
  130. $table .= '<td>'.$level.'</td>';
  131. $table .= '<td>'.number_format($xp , 0 , '.' , ',').'</td>';
  132. $table .= '<td>'.$lastTime.'</td>';
  133. $table .= '<td>'.$activeGames.'</td>';
  134. $table .= '<td>'.$totalGames.'</td>';
  135. $table .= '<td>'.$wins.'</td>';
  136. $table .= '<td>'.number_format(rand(100,2000), 0 , '.' , ',').'</td>';
  137. $table .= '<td>'.$totalPurchaseCount.'</td>';
  138. $table .= '<td>$'.number_format($value , 2 , '.' , ',').'</td>';
  139. $table .= '<td>'.rand(100,1000).'</td>';
  140. $table .= '<td>'.rand(100,1000).'</td>';
  141. $table .= '<td>'.rand(100,1000).'</td>';
  142. $table .= '<td>'.rand(100,1000).'</td>';
  143. $table .= '</tr>';
  144. echo $table;
  145. }
  146. }
  147. echo '</tbody></table>';
  148. echo '</div>';
  149. date_default_timezone_set('UTC');

  150. $activeGames = 1000;

  151. $completedGames = 5550;

  152. $pendingGames = 200;
  153. $usersDaily = 600;
  154. $value = 1 * 0.99 + 2 * 2.99 + 3 * 5.99 + 4 * 1.99;
  155. $avgDailyValue = number_format(($value/$usersDaily) , 2 , '.' , ',');
  156. $usersWeekly = 2000;
  157. $value = 1 * 0.99 + 2 * 2.99 + 3 * 5.99 + 4 * 1.99;
  158. $avgWeeklyValue = number_format(($value/$usersWeekly) , 2 , '.' , ',');
  159. $usersMonthly = 4000;
  160. $value = 1 * 0.99 + 2 * 2.99 + 3 * 5.99 + 4 * 1.99;
  161. $avgMonthlyValue = number_format(($value/$usersMonthly) , 2 , '.' , ',');
  162. $adFreeCount = 750;
  163. echo '<hr>';
  164. echo '<div id="totalDiv" style="overflow-y:scroll; height:40%;">';
  165. echo '<table id="totals">';
  166. echo '<tr>
  167. <td>Total Paid</td><td> '.$adFreeCount.'</td>';
  168. echo '<td style="padding-left:150px;">Most active player </td><td> ' . $mostActiveName . ' with ' . $mostActiveCount . ' games played</td>';
  169. echo '</tr>
  170. <tr>';
  171. echo '<td>Number of active games </td><td> ' . $activeGames . '</td>';
  172. echo '<td style="padding-left:150px;">Player with the most wins </td><td> ' . $mostWonName . ' with ' . $mostWonCount . ' wins</td>';
  173. echo '</tr>
  174. <tr>';
  175. echo '<td>Number of completed games </td><td> ' . $completedGames. '</td>';
  176. echo '<td style="padding-left:150px;">Player with the most Skill Points </td><td> ' . $mostXPName . ' with ' . number_format($mostXPCount , 0 , '.' , ',') . ' Skill Points - Recruit</td>';
  177. echo '</tr>
  178. <tr>';
  179. echo '<td>Number of pending games </td><td> ' . $pendingGames . '</td>';
  180. echo '<td style="padding-left:150px;">Player with the highest amount spent </td><td> ' . $mostSpentName . ' with $' . $mostSpentCount . '</td>';
  181. echo '</tr></table>';
  182. echo '<div id="container">';
  183. echo '<div id = "col1" class="column_n">';
  184. echo '</br><table id="totals"><tr><th>User Type</th><th>Count</th><th>Average Gross</th><th>Average Net</th></tr>';
  185. echo '<tr><td>Daily Active</td><td style="text-align:center;"> ' . $usersDaily . '</td><td style="text-align:center;">$'.$avgDailyValue.'</td><td style="text-align:center;"> $'. number_format($avgDailyValue * 0.7 , 2 , '.' , ',') .'</td>';
  186. echo '</tr>
  187. <tr>';
  188. echo '<td>Weekly Active</td><td style="text-align:center;"> ' . $usersWeekly . '</td><td style="text-align:center;">$'.$avgWeeklyValue.'</td><td style="text-align:center;"> $'. number_format($avgWeeklyValue * 0.7 , 2 , '.' , ',') .'</td>';
  189. echo '</tr>
  190. <tr>';
  191. echo '<td>Monthly Active</td><td style="text-align:center;"> ' . $usersMonthly . '</td><td style="text-align:center;">$'.$avgMonthlyValue.'</td><td style="text-align:center;"> $'. number_format($avgMonthlyValue * 0.7 , 2 , '.' , ',') .'</td>';
  192. echo '</tr>
  193. <tr>';
  194. echo '<td>Total Users</td><td style="text-align:center;"> ' . $numUsers . '</td><td style="text-align:center;">$'.number_format(($totalSales/$numUsers) , 2 , '.' , ',').'</td><td style="text-align:center;"> $'. number_format($totalSales * 0.7 , 2 , '.' , ',') .'</td>';
  195. echo '</tr>';
  196. echo '<tr><th>Total Sales</th><th style="text-align:center;">Gross</th><th style="text-align:center;">Net</th></tr>';
  197. echo '<tr><td></td><td style="text-align:center;"> $'.$totalSales.'</td><td style="text-align:center;"> $'. number_format($totalSales * 0.7 , 2 , '.' , ',') .'</td></tr></table>';
  198. echo '</div>';

  199. $num_ios = 10;
  200. $num_android = 20;

  201. $num_other = 30;

  202. $num_ios_qr = 40;

  203. $num_android_qr = 50;
  204. $num_other_qr = 60;

  205. echo '<div id ="col2" class="column_n">';
  206. echo '</br><table id="totals">';
  207. echo '<tr><th colspan="3" style="text-align:center;">Hits To Store Link</th></tr>';
  208. echo '<tr><th>OS</th><th>In-App (Ad-Free)</th><th>QR Code</th></tr>';
  209. echo '<tr>';
  210. echo '<td>Andriod</td>';
  211. echo '<td style="text-align:center;">' . $num_android . '</td>';
  212. echo '<td style="text-align:center;">' . $num_android_qr . '</td>';
  213. echo '</tr>';
  214. echo '<tr>';
  215. echo '<td>iOS</td>';
  216. echo '<td style="text-align:center;">' . $num_ios . '</td>';
  217. echo '<td style="text-align:center;">' . $num_ios_qr . '</td>';
  218. echo '</tr>';
  219. echo '<tr>';
  220. echo '<td>Other</td>';
  221. echo '<td style="text-align:center;">' . $num_other . '</td>';
  222. echo '<td style="text-align:center;">' . $num_other_qr . '</td>';
  223. echo '</tr>';
  224. echo '<tr>';
  225. echo '<td>Total</td>';
  226. $sum = $num_android + $num_ios + $num_other;
  227. echo '<td style="text-align:center;">' . $sum . '</td>';
  228. $sum = $num_android_qr + $num_ios_qr + $num_other_qr; 
  229. echo '<td style="text-align:center;">' . $sum . '</td>';
  230. echo '</tr>';
  231. echo '</table>';
  232. echo '</div>';
  233. echo '</div>';
  234. echo '</body></html>';
  235. ?>