Gaining access to hidden column in response to a click
Gaining access to hidden column in response to a click
energetic_pixels
Posts: 9Questions: 0Answers: 0
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
[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
This discussion has been closed.
Replies
Use the fnGetData method on the TR element and you'll get the data for the whole row, regardless of column visibility :-)
Allan
I think this (Datatables) is better than Flexigrid. Atleast for my particular application.
Tony