By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,919 Members | 1,074 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,919 IT Pros & Developers. It's quick & easy.

table sorting doesnt work in firefox? but everywhere else

P: 29
i have a table sorting feature on my website that works everywhere else except in firefox. but the example code does work in firefox. this has me stumped.

The problem is the links in the table headers wont show up so they can be clicked on to sort the colunm.

here is my webpage code that displays the data in a table.....

Expand|Select|Wrap|Line Numbers
  1. $get_list_sql = "SELECT * FROM products WHERE Category = '".$_POST['select']."'";
  2.     $result = mysqli_query($mysqli, $get_list_sql) or die(mysqli_error($mysqli));
  3. }    
  4.     $display_block = "<p align = 'center'> <table id =' mytable' class='sortable' border = '1' bordercolor = 'black' cellpadding= '0' cellspacing = '0'>
  5. <thead>
  6.     <th  id = 'Item' scope= 'col' bgcolor = 'orange'>Item Number</th>
  7.     <th  id = 'Man' scope= 'col' bgcolor = 'orange'>Manufacturer</th>
  8.     <th  id = 'Cat' scope= 'col' bgcolor = 'orange'>Category</th>
  9.     <th  id = 'Des' scope= 'col' bgcolor = 'orange'>Description</th>
  10.     <th  id = 'Model' scope= 'col' bgcolor = 'orange'>Model</th>
  11.     <th  id = 'Quant' scope= 'col' bgcolor = 'orange'>Quantity</th>
  12.     <th  id = 'Kw' scope= 'col' bgcolor = 'orange'>Kw</th>
  13.     <th  id = 'Hour' scope= 'col' bgcolor = 'orange'>Hours</th>
  14.     <th  id = 'Price' scope= 'col' bgcolor = 'orange'>Price</th> 
  15. </thead>
  16. <tbody>";
  17.  
  18. //if authorized, get the values
  19.     while ($info = mysqli_fetch_array($result)) {
  20.  
  21. //create display string
  22. $display_block .= "
  23. <tr>
  24. <td>".$info['Item_No']."</td>
  25. <td>".$info['Manufacturer']."</td>
  26. <td>".$info['Category']."</td>
  27. <td>".$info['Description']."</td>
  28. <td>".$info['Model']."</td>
  29. <td>".$info['Qty']."</td>
  30. <td>".$info['Kw']."</td>
  31. <td>".$info['Hours']."</td>
  32. <td>".$info['Price']."</td>
  33. </tr>";
  34. }
  35.     $display_block .= "</tbody></table></p>"; 
  36. ?>
  37.  
here is a snippet out of the table-sorting.js file that creates the links in these table headers to click on so they can be sorting..

Expand|Select|Wrap|Line Numbers
  1.     // create a link with an onClick event which will 
  2.             // control the sorting of the table
  3.             var linkEl = createElement('a');
  4.             linkEl.href = '#';
  5.             linkEl.onclick = this.headingClicked;
  6.             linkEl.setAttribute('columnId', i);
  7.             linkEl.title = 'Click to sort';
  8.  
  9.             // move the current contents of the cell that we're 
  10.             // hyperlinking into the hyperlink
  11.             var innerEls = row.cells[i].childNodes;
  12.             for (var j = 0; j < innerEls.length; j++) {
  13.                 linkEl.appendChild(innerEls[j]);
  14.             }
  15.  
  16.             // and finally add the new link back into the cell
  17.             row.cells[i].appendChild(linkEl);
  18.  
I am not that savvy with javascript and I think I narrowed the problem here but not sure?? I am desperately seeking some help on this. any help is appreciatted
Sep 13 '07 #1
Share this Question
Share on Google+
2 Replies


pbmods
Expert 5K+
P: 5,821
Heya Cluce. Welcome to TSDN!

Please use CODE tags when posting source code:

[CODE=javascript]
JavaScript code goes here.
[/CODE]
Sep 14 '07 #2

P: 29
can someone tell me why this will give me links in my table headers but not my sql query when viewing the web page in firefox only.

Expand|Select|Wrap|Line Numbers
  1.   $display_block = "<p align = 'center'> <table class='sortable' border = '1' bordercolor = 'black' cellpadding= '0' cellspacing = '0'>
  2. <thead>
  3.                 <tr>
  4.                     <td></td>
  5.                     <th colspan='2'>Name</th>
  6.                     <td></td>
  7.                     <td></td>
  8.                     <td></td>
  9.                 </tr>
  10.                 <tr>
  11.                     <th>Date</th>
  12.                     <th>Forename</th>
  13.                     <th>Surname</th>
  14.                     <th>Number</th>
  15.                     <th>Price</th>
  16.                     <th>IP Address</th>
  17.                     <th>Scientific</th>
  18.                 </tr>
  19.             </thead>
  20.             <tfoot>
  21.                 <tr>
  22.                     <td></td>
  23.                     <td></td>
  24.                     <td></td>
  25.                     <th class='numeric'>385</th>
  26.                     <th class='numeric'>$160.91</th>
  27.                     <td></td>
  28.                     <td></td>
  29.                 </tr>
  30.             </tfoot>
  31.             <tbody>
  32.                 <tr>
  33.                     <td>21/01/2006</td>
  34.                     <td>Neil</td>
  35.                     <td>Crosby</td>
  36.                     <td class='numeric'>123</td>
  37.                     <td class='numeric'>$1.96</td>
  38.                     <td>192.168.1.1</td>
  39.                     <td>-12E2</td>
  40.                 </tr>
  41.                 <tr class='odd'>
  42.                     <td>01/02/2006</td>
  43.                     <td>Becca</td>
  44.                     <td>Courtley</td>
  45.                     <td class='numeric'>122</td>
  46.                     <td class='numeric'>$23.95</td>
  47.                     <td>192.167.2.1</td>
  48.                     <td>12E2</td>
  49.                 </tr>
  50.                 <tr>
  51.                     <td>17/11/2004</td>
  52.                     <td>David</td>
  53.                     <td>Freidman</td>
  54.                     <td class='numeric'>048</td>
  55.                     <td class='numeric'>$14.00</td>
  56.                     <td>192.168.2.1</td>
  57.                     <td>13e-2</td>
  58.                 </tr>
  59.                 <tr class='odd'>
  60.                     <td>17/10/2004</td>
  61.                     <td>Sylvia</td>
  62.                     <td>Tyler</td>
  63.                     <td class='numeric'>43</td>
  64.                     <td class='numeric'>$104.00</td>
  65.                     <td>192.168.2.17</td>
  66.                     <td>12.1e2</td>
  67.                 </tr>
  68.                 <tr>
  69.                     <td>17/11/2005</td>
  70.                     <td>Carl</td>
  71.                     <td>Conway</td>
  72.                     <td class='numeric'>49</td>
  73.                     <td class='numeric'>$17.00</td>
  74.                     <td>192.168.02.13</td>
  75.                     <td>12e3</td>
  76.                 </tr>
  77.             </tbody>
  78.         </table>";
  79. ?>
  80.  
Sep 14 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.