rem: filtersToRestore = resetAllFilters(); 
add: filtersToRestore = resetAllFilters(); 
context: function bindDataTableEvent( indexDiv ){	var workingDivId;	// Array containing the subDataTables ID already loaded. So that when collapsing expanding the same sub Table	// There is only the first AJAX query and the next times it is read from an array	var DataTableAlreadyLoaded = new Array;		// ID of the DIV containing the DataTable we are currently working on	workingDivId = $(this).attr('id');			// reset All filters set to false all the datatable filters JS variables	// returns the values before reseting the filters	function resetAllFilters()	{		var FiltersToRestore = new Array();		filters = [ 			'filter_column', 			'filter_pattern', 			'filter_excludelowpop',			'filter_excludelowpop_value',			'filter_offset',			'filter_limit',			'filter_sort_column',			'filter_sort_order',		];				for(key in filters)		{			value = filters[key];			FiltersToRestore[value] = getRequestVariable(workingDivId,value);			//if(FiltersToRestore[value]!=false) alert('save '+value+'='+FiltersToRestore[value]);			setVariable(workingDivId, value, false);		}						return FiltersToRestore;	}		// Restores the filters to the values given in the array in parameters	function restoreAllFilters(FiltersToRestore)	{		for(key in FiltersToRestore)		{ 			value = FiltersToRestore[key];			setVariable(workingDivId, key, value);		}	}		/* List of the filters to be applied		// pattern search		'filter_column'		'filter_pattern'				// remove rows for which a given column is less than a given value		'filter_excludelowpop'		'filter_excludelowpop_value'				// order by some column 		'filter_sort_column'		'filter_sort_order'				// offset, limit		'filter_offset'		'filter_limit'	*/	handleSearchBox( workingDivId, this );	handleLowPopulationLink( workingDivId, this );		// Showing the offset information (1 - 10 of 42) for this DIV	if( getRequestVariable(workingDivId, 'show_offset_information' ) == true )	{		$('#dataTablePages', this).each(			function(){				var offset = 1+Number(getRequestVariable(workingDivId,'filter_offset'));				var offsetEnd = Number(getRequestVariable(workingDivId,'filter_offset')) 									+ Number(getRequestVariable(workingDivId,'filter_limit'));				var totalRows = Number(getRequestVariable(workingDivId,'totalRows'));				offsetEndDisp = offsetEnd;				if(offsetEnd > totalRows) offsetEndDisp = totalRows;				var str = offset + '-' + offsetEndDisp + ' of ' + totalRows;				$(this).text(str);			}		);	}		// if sorting the columns is enabled, when clicking on a column, 	// - if this column was already the one used for sorting, we revert the order desc<->asc	// - we send the ajax request with the new sorting information	if( getRequestVariable(workingDivId, 'enable_sort' ) == true)	{		$('.sortable', this).click( 			function(){				var newColumnToSort = $(this).attr('id');				// we lookup if the column to sort was already this one, if it is the case then we switch from desc <-> asc 				var currentSortedColumn =  getRequestVariable(workingDivId,'filter_sort_column');				var currentSortedOrder = getRequestVariable(workingDivId,'filter_sort_order');				if(currentSortedColumn == newColumnToSort) 				{					// toggle the sorted order					if(currentSortedOrder == 'asc')					{						currentSortedOrder = 'desc';					}					else					{						currentSortedOrder = 'asc';					}				}				setVariable(workingDivId, 'filter_offset', 0); 				setVariable(workingDivId, 'filter_sort_column', newColumnToSort);				setVariable(workingDivId, 'filter_sort_order', currentSortedOrder);				reloadAjaxDataTable(workingDivId);			}		);			// we change the style of the column currently used as sort column		// adding an image and the class columnSorted to the TD		var currentSortedColumn = getRequestVariable(workingDivId,'filter_sort_column');		var currentSortedOrder = getRequestVariable(workingDivId,'filter_sort_order');		$(".sortable[@id='"+currentSortedColumn+"']", this)			.addClass('columnSorted')			.append('<img src="themes/default/images/sort'+ currentSortedOrder+'.png">');	}			// Display the next link if the total Rows is greater than the current end row	$('#dataTableNext', this)		.each(function(){			var offsetEnd = Number(getRequestVariable(workingDivId,'filter_offset')) 								+ Number(getRequestVariable(workingDivId,'filter_limit'));			var totalRows = Number(getRequestVariable(workingDivId,'totalRows'));			if(offsetEnd < totalRows)			{				$(this).css('display','inline');			}		})		// bind the click event to trigger the ajax request with the new offset		.click(function(){			setVariable(workingDivId, 'filter_offset', 								Number(getRequestVariable(workingDivId,'filter_offset')) 								+ Number(getRequestVariable(workingDivId,'filter_limit'))				); 			reloadAjaxDataTable(workingDivId);		})	;		// Display the previous link if the current offset is not zero	$('#dataTablePrevious', this)		.each(function(){				var offset = 1+Number(getRequestVariable(workingDivId,'filter_offset'));				if(offset != 1)				{					$(this).css('display','inline');				}			}		)		// bind the click event to trigger the ajax request with the new offset		// take care of the negative offset, we setup 0 		.click(			function(){				var offset = getRequestVariable(workingDivId,'filter_offset') - getRequestVariable(workingDivId,'filter_limit');				if(offset < 0) { offset = 0; }				setVariable(workingDivId, 'filter_offset', offset); 				reloadAjaxDataTable(workingDivId);			}		)	;			// we truncate the labels columns from the second row	$("table tr td:first-child", this).truncate(30);    $('.truncated', this).Tooltip();		// we add a link based on the <span id="urlLink"> present in the column label (the first column)	// if this span is there, we add the link around the HTML in the TD	// but we add this link only for the rows that are not clickable already (subDataTable)	$("tr:not('.subDataTable') td:first-child:has('#urlLink')", this).each( function(){				var imgToPrepend = '';		if( $(this).find('img').length == 0 )		{			imgToPrepend = '<img src="themes/default/images/link.gif" /> ';		}		var urlToLink = $('#urlLink',this).text();						$(this).html( 			'<a target="_blank" href="' + urlToLink + '">' + imgToPrepend + $(this).html() + '</a>'		);	});	// Add some styles on the cells even/odd	// label (first column of a data row) or not	$("td:first-child:odd", this).addClass('label labelodd');	$("td:first-child:even", this).addClass('label labeleven');	$("tr:odd td", this).slice(1).addClass('columnodd');	$("tr:even td", this).slice(1).addClass('columneven');	$("th", this).hover( function() {  	 	 $(this).css({ cursor: "pointer"}); 	  	},	  	function() {  	 	 $(this).css({ cursor: "auto"}); 	  	} 	);	// When the TR has a subDataTable class it means that this row has a link to a subDataTable	$('tr.subDataTable', this)		.click( 		function()		{			// get the idSubTable			var idSubTable = $(this).attr('id');			var divIdToReplaceWithSubTable = 'subDataTable_'+idSubTable;						if( !DataTableAlreadyLoaded[idSubTable] )			{				// if the subDataTable is not in the array of already loaded tables												var numberOfColumns = $(this).children().length;								// at the end of the query it will replace the ID matching the new HTML table #ID				// we need to create this ID first				$(this).after( '\				<tr>\					<td colspan="'+numberOfColumns+'">\						<div id="'+divIdToReplaceWithSubTable+'">\							<span id="loadingDataTable" style="display:inline"><img src="themes/default/images/loading-blue.gif"> Loading...</span>\						</div>\					</td>\				</tr>\				');								var savedActionVariable = getRequestVariable(workingDivId,'action');				// reset all the filters from the Parent table				filtersToRestore = resetAllFilters();								setVariable(workingDivId, 'idSubtable', idSubTable);				setVariable(workingDivId, 'action', getRequestVariable(workingDivId,'actionToLoadTheSubTable'));				reloadAjaxDataTable(workingDivId, false );				setVariable(workingDivId, 'action', savedActionVariable);				setVariable(workingDivId, 'idSubtable', false);				toString(filtersToRestore);				restoreAllFilters(filtersToRestore);												// add a new row after this one and set the HTML subTable in it				DataTableAlreadyLoaded[idSubTable] = 1;								$(this).next().toggle();			}						$(this).next().toggle();		} 	);		}
meta: 635	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/635/635cf05238806c8a032bba9b371d70abf10d2c7e/datatable.js/buggy/plugins/UserSettings/templates/datatable.js