fnFilter cache results
fnFilter cache results
Hi all, have a screen where everything works fine. Expect one thing. My fnFilter works just fine when using it from drop down list on the screen. However when I close the screen and reopen it the value is cached to previous selected value. I have the below code occuring to reset it on open but it doesn't ever happen. I verified the "reset" method works by putting and alert in there. But setting the fnFilter to an empty string value doesn't work. Is there something else I need to do?
window.onopen = reset();
function reset(){
$(dataTableId).dataTable().fnFilter("" , 4, true, false, false, false);
}
This is the code that handles the drop down list that works now
function changeType(){
var dataTableId = '#standard_datatable';
var selectedValue = document.getElementById("feedType").value;
$(dataTableId).dataTable().fnFilter(selectedValue , 4, true, false, false, false);
}
This is my data table.
// Data Table
$(dataTableId).cmaDataTable({
sortTableByCol : 2,
ajaxSource : "/cma/contents/load_data",
flagHideColumns : true,
flagShowStatusFlag : false,
arrayOfColumnsToHide : []
});
This is my select list
<
div style="height: 48px" align=right>
File Feed Type:
<select name='feedType' id='feedType' onChange=changeType() style="font-size:11px;">
<option value=""> </option>
<option value="dutyReferenceFeed">Duty Reference</option>
<option value="exportControlClassificationMapFeed">Export Control Classification Map</option>
</select>
Answers
Happy to take a look at a test case showing the issue. Also I'd suggest you use
column().search()
rather than the legacy fnFilter method as that will be removed in the next major update.Allan
ok I changed it to now use the "search" but I am getting exact same results, below is code
This is triggered by an "onChange" in the drop down list. This works. Problem is it retains this value when I close and reopen the screen.
I experimented with this type of code on on but no luck. Doing all this using chrome if it matters
Hi @vsek ,
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin