views:

40

answers:

1

I will use the jquery plugin datatables. I saw fnRowCallback in the docs, but it seemed complicated.

How would the code look like if I make 2 types of changes to the rows and data of a table that looks like this:

<table class='activitylocation'>
  <tbody>
    <tr>
      <td>John Smith</td>
      <td>123 Fake St</td>
      <td>lat_1</td>
      <td>lon_1</td>
    </tr>
    <tr>
      <td>XX MAN</td>
      <td>12333 Fake St</td>
      <td>lat_2</td>
      <td>lon_2</td>
    </tr>
  </tbody>
</table>

Change 1 relates to inserting information into each row based on its data:

<tr onlick="my_function1('John Smith');" onMouseOver="my_function2('lat_1','lon_1')" >

Change 2 is to make 2 data elements of each row hidden by inserting this type of information:

  <td class='hide'>lat_1</td>
  <td class='hide'>lon_1</td>

I will be pulling the data from PHP server. The trick will be to make links from the data table to a web map. I am jquery and datatables novice. Any help is greatly appreciated!

+1  A: 

If I get your question right here is what you should do:

Please dont use oneclick stuff, declare all the handlers in thehead section instead:

$('tr').click(function() {
    var name = $(this).children().eq(0);
    var lat_1 = $(this).children().eq(2);
    var lon_1 = $(this).children().eq(3);
});

If you use hide() function probably you will mess a table structure so maybe the best way should set visibility to hidden

$('td:eq(2), td:es(3)').css('visibility', 'hidden');

I hope this helps

Mike
tHANKS Yes it helps!
indiehacker
Warning: Actually still having problems.....with .css code above
indiehacker
http://stackoverflow.com/questions/3296495/hide-column-td-of-the-table-by-using-jquery
indiehacker
$(document).ready(function() { $('tr td:nth-child(1)').hide();}
indiehacker