Get Data from cell on click
Get Data from cell on click
Im ultimately trying to change an image on click so as to say make a favorite star change from gray to yellow.
But first I have to know how to access the cell value. I have yet to figure this out. Could someone please help me.
[code]
var mytable;
$(document).ready(function() {
mytable = $('#ImbalanceData').dataTable( {
"bProcessing": false,
"bJQueryUI": false,
"bPaginate": false,
"sAjaxSource": 'my.json',
"iDisplayLength": -1,
"aaSorting": [[ 0, "asc" ],[ 1, "desc" ]],
"aoColumns":[
/* Star*/ { "asSorting": [ "asc" ] },
/* Symbol*/ null,
/* Buy IMB*/ null,
/*Sell IMB*/ null,
/*Paired*/ null,
/*Price */ { "bVisible": false },
/*Percentage*/ { "bVisible": false },
/*Previous*/ { "bVisible": false },
/*Status*/ { "bVisible": false }]
} );
$ ('#ImbalanceData td').live ('click', function() {
alert($(this).data);
});
} );
[/code]
But first I have to know how to access the cell value. I have yet to figure this out. Could someone please help me.
[code]
var mytable;
$(document).ready(function() {
mytable = $('#ImbalanceData').dataTable( {
"bProcessing": false,
"bJQueryUI": false,
"bPaginate": false,
"sAjaxSource": 'my.json',
"iDisplayLength": -1,
"aaSorting": [[ 0, "asc" ],[ 1, "desc" ]],
"aoColumns":[
/* Star*/ { "asSorting": [ "asc" ] },
/* Symbol*/ null,
/* Buy IMB*/ null,
/*Sell IMB*/ null,
/*Paired*/ null,
/*Price */ { "bVisible": false },
/*Percentage*/ { "bVisible": false },
/*Previous*/ { "bVisible": false },
/*Status*/ { "bVisible": false }]
} );
$ ('#ImbalanceData td').live ('click', function() {
alert($(this).data);
});
} );
[/code]
This discussion has been closed.
Replies
alert(this.innerHTML); ?
Don't think you need a DataTables specific function here - although I might be missing something?
Allan