Gaining access to hidden column in response to a click

Gaining access to hidden column in response to a click

energetic_pixelsenergetic_pixels Posts: 9Questions: 0Answers: 0
edited April 2012 in General
I have a datatable where users are clicking on a row and then pulling external data into another specific div. But my code does not do anything but sit there when user clicks. Here is everything inside the .ready(function() line.
[code]
$("#catList tbody").click(function(event) {
$(oTable.fnSettings().aoData).each(function (){
$(this.nTr).removeClass('row_selected');
/*event.stopPropagation();
event.preventDefault();*/
alert ('you clicked ' + $(this.nTr) + mDataProp);
/*$('#content').load($(this).aTargets);*/
});
$(event.target.parentNode).addClass('row_selected');
});
oTable = $('#catList').dataTable({
"bProcessing": true,
"sAjaxSource": 'catalog/catalog.json',
"bSort": false,
"bPaginate": true,
"bLengthChange": true,
"bFilter": true,
"bInfo": true,
"bAutoWidth": false,
"aoColumnDefs": [
{"sTitle": "Course Title", "bVisible": true, "mDataProp": "longTitle", "aTargets": [0] },
{"sTitle": "Long Description Link", "bVisible": false, "mDataProp": "longDescript", "aTargets": [1] },
{"sTitle": "ATRRS Link", "bVisible": false, "mDataProp": "atrrsLink", "aTargets": [2] }
]
});
[/code]

The table displays nicely, And I can make the alert say stupid things upon a user click. I just can not ultimately get it to do a jQuery .load as result of click operation. I have a simple hyperlink stored in a hidden TD on the table. The variable that I am trying to access is called "longDescript".

Any help would be greatly appreciated.

Tony

Replies

  • allanallan Posts: 63,810Questions: 1Answers: 10,516 Site admin
    > I have a simple hyperlink stored in a hidden TD on the table.

    Use the fnGetData method on the TR element and you'll get the data for the whole row, regardless of column visibility :-)

    Allan
  • energetic_pixelsenergetic_pixels Posts: 9Questions: 0Answers: 0
    Thank you. And after digging and getting another cup of hot cocoa, I found an example on the Examples -> Events (Live). But your example seems easier, I think. Thank you.

    I think this (Datatables) is better than Flexigrid. Atleast for my particular application.

    Tony
This discussion has been closed.