Filter row after altering the content
Filter row after altering the content
I have a datatable where there is the option to click a button which will update all of the content for one column. This column no longer filters after this new data is dynamically added. Can someone please explain how I can reinitialize this column to work with the filters?
Some of my code :
[code]
//
//
//something like this goes through each cell and changes the content
var handleImageCheck = function(i){
var rows = oTable.fnGetNodes();
if($j(rows[i]).length)
{
grabsku = $j(rows[i]).find('td:eq(2)').text();
imgreplace = $j(rows[i]).find('td:eq(1)');
// i do some stuff here to generate what z is
imgreplace.html(z);
handleImageCheck(i);
i++;
} else { alert ("all done"); }
}
// how i execute datatables
oTable = $j('#myTable').dataTable( {
"sPaginationType": "full_numbers",
"oLanguage": {
"sSearch": "Search all columns:"
}
});
// and here is how i am doing the filters
(function($) {
$.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique, bFiltered, bIgnoreEmpty ) {
if ( typeof iColumn == "undefined" ) return new Array();
if ( typeof bUnique == "undefined" ) bUnique = true;
if ( typeof bFiltered == "undefined" ) bFiltered = true;
if ( typeof bIgnoreEmpty == "undefined" ) bIgnoreEmpty = true;
var aiRows;
if (bFiltered == true) aiRows = oSettings.aiDisplay;
else aiRows = oSettings.aiDisplayMaster;
var asResultData = new Array();
for (var i=0,c=aiRows.length; i -1) continue;
else asResultData.push(sValue);
asResultData.sort();
}
return asResultData;
}}(jQuery));
[/code]
I dont really understand the filter code but guess I need to refresh some of those variables when the handleImageCheck function is finished. I saw something about redraw but I couldnt figure out how to use that in this scenario. Thanks for any help with this.
Some of my code :
[code]
//
//
//something like this goes through each cell and changes the content
var handleImageCheck = function(i){
var rows = oTable.fnGetNodes();
if($j(rows[i]).length)
{
grabsku = $j(rows[i]).find('td:eq(2)').text();
imgreplace = $j(rows[i]).find('td:eq(1)');
// i do some stuff here to generate what z is
imgreplace.html(z);
handleImageCheck(i);
i++;
} else { alert ("all done"); }
}
// how i execute datatables
oTable = $j('#myTable').dataTable( {
"sPaginationType": "full_numbers",
"oLanguage": {
"sSearch": "Search all columns:"
}
});
// and here is how i am doing the filters
(function($) {
$.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique, bFiltered, bIgnoreEmpty ) {
if ( typeof iColumn == "undefined" ) return new Array();
if ( typeof bUnique == "undefined" ) bUnique = true;
if ( typeof bFiltered == "undefined" ) bFiltered = true;
if ( typeof bIgnoreEmpty == "undefined" ) bIgnoreEmpty = true;
var aiRows;
if (bFiltered == true) aiRows = oSettings.aiDisplay;
else aiRows = oSettings.aiDisplayMaster;
var asResultData = new Array();
for (var i=0,c=aiRows.length; i -1) continue;
else asResultData.push(sValue);
asResultData.sort();
}
return asResultData;
}}(jQuery));
[/code]
I dont really understand the filter code but guess I need to refresh some of those variables when the handleImageCheck function is finished. I saw something about redraw but I couldnt figure out how to use that in this scenario. Thanks for any help with this.
This discussion has been closed.