That will work if oTable is a global variable (i.e. declared outside the scope of a function). At least I think it should! However, what I would recommend is that you don't use DOM0 events (onclick and the like) and instead use jQuery to do the events for you. If you add an ID to your input of "button" (or whatever) then you can do:
$('#button').click( function () {
oTable.fnDraw();
} );
} );
[/code]
In the long run using jQuery events can save a lot of grief :-) Also it's good from the stand point of progressive enhancement.
Replies
Allan
[code][/code]
Is that correct?
[code]
$(document).ready(function() {
oTable = $('#tblTabela').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "VINCULADOS2_ajax.asp",
"sPaginationType": "full_numbers",
"fnServerData": function ( sSource, aoData, fnCallback ) {
var vlrAgrupador = document.getElementById("cnpjEncontrado").value;
aoData.push( { "name": "vlrAgrupador", "value": vlrAgrupador } );
$.getJSON( sSource, aoData, function (json) {
fnCallback(json)
} );
},
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
$(nRow).addClass('gradeC');
return nRow;
}
} );
} );
[/code]
[code]
$(document).ready(function() {
var oTable = $('#tblTabela').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "VINCULADOS2_ajax.asp",
"sPaginationType": "full_numbers",
"fnServerData": function ( sSource, aoData, fnCallback ) {
var vlrAgrupador = document.getElementById("cnpjEncontrado").value;
aoData.push( { "name": "vlrAgrupador", "value": vlrAgrupador } );
$.getJSON( sSource, aoData, function (json) {
fnCallback(json)
} );
},
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
$(nRow).addClass('gradeC');
return nRow;
}
} );
$('#button').click( function () {
oTable.fnDraw();
} );
} );
[/code]
In the long run using jQuery events can save a lot of grief :-) Also it's good from the stand point of progressive enhancement.
Regards,
Allan