Using fnReloadAjax doesn't update the choices in the column filters

Using fnReloadAjax doesn't update the choices in the column filters

mscottpolymorphmscottpolymorph Posts: 2Questions: 0Answers: 0
edited January 2014 in Bug reports
Hi all.

I have a datatable that initialises to an ajax source using the sAjaxSource param in the usual manner.
I also have some columns set to have column filtering in the tfoot and all works great.

This datatable pulls back a table of person details.

On my page, I have a button that sends a request to our server to set a 'name starts with' value which then seeds the code that the sAjaxSource is pulling data from.
In the click on this button, I then use fnReloadAjax against the datatable to re-pull data which results in a different dataset being returned.

So far so good, all this works fine.

The problem I have is that the options in the fields produced by the Column Filtering are never updated to reflect the changes in the data now visible in the table after calling fnReloadAjax. For example, one of my columns is Surname, the column filter shows me all the surnames beginning with the letter A.
I then click my button to change this to (for example) the letter L, the datatable re-loads from the ajax source and displays a table of people who's name begins with 'L' but the at the bottom of the column still shows me options for surnames beginning with 'A'.

I have tried a callback function on fnReloadAjax but no matter what I try (fnDraw, fnStandingRedraw tried so far) I cannot get it to recompute the column filter options. Even if I clear out the table data in the callback, the options are still there.

Any ideas would be gratefully received!

Cheers,
Matt

Replies

  • allanallan Posts: 55,883Questions: 1Answers: 8,835 Site admin
    edited January 2014
    You were right to try and use a callback function with fnReloadAjax - the options need to be updated for the new data. What did you try?

    Edit - I just noticed the capitalisation of "Column Filtering" - are you using a plug-in? If so, which one? You might be best asking on the project pages of whatever column filtering plug-in you are using.

    Allan
  • mscottpolymorphmscottpolymorph Posts: 2Questions: 0Answers: 0
    Hi Allan,

    Thanks for getting back to me. You poked my memory about it being a plug-in - I hadn't noticed (as I'm working in a team) that this wasn't built-in functionality.

    Turns out I'm using this:
    * File: jquery.dataTables.columnFilter.js
    * Version: 1.5.1.
    * Author: Jovan Popovic

    ...so I'll go and have a dig around in there!

    Cheers!
    Matt
This discussion has been closed.