HELP - Column sort after fnFilter removes filter / shows all data

HELP - Column sort after fnFilter removes filter / shows all data

trimpertrimper Posts: 3Questions: 0Answers: 0
edited August 2009 in General
I have setup datatables with various columns, all sortable and implemented a custom series of dropdown filters. Any time I perform a filter, then choose to sort a column - the filter becomes wiped out.

here is an example of one of my filter in document ready
[code]
$('#priority_filter').change(function()
{
var filter = this.value;
if(filter == 'none')
{
oTable.fnFilter('', 6);
}
else{
oTable.fnFilter(filter, 6);
}
});
[/code]

Is there some sort of 'notification' that needs to be made when fnSort is called? (Note - i am using the standard column sorts that come preloaded)

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi trimper,

    Sounds like quite an odd one. I've just tried what you describe in my individual column filtering example ( http://datatables.net/examples/api/multi_filter.html ) and can't reproduce the problem - can you in my example? Could you post a link to your example, and also say what version of DataTables you are using?

    Thanks,
    Allan
  • trimpertrimper Posts: 3Questions: 0Answers: 0
    edited August 2009
    Thanks for the reply Allan!

    I have scrubbed any confidential data and replaced it with fun stuff. Please disregard the issue I'm having with stylesheets in IE, I haven't finished the template yet. Also, this is a static copy, so the release selector & refresh buttons will do nothing...

    Link to sample report: http://christrimper.com/testing/rpt/table_test.php

    I am using DataTables 1.5.0 with the TableTools addon for easy export.

    Thanks in advance,
    Trimper
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi Trimper,

    Had me puzzled for a little bit there! Thanks for the link - made it much easier! The problem that you have ""bFilter": false" - so DataTables isn't doing any filtering (you do because you are doing it manually). So The way to fix it is to not disable filtering - but you will want to remove the standard filtering input. This is done using the sDom initialisation parameter: http://datatables.net/usage/options#sDom . Just drop the 'f' option and DataTables won't draw the filtering input, but filtering will still be enabled.

    Regards,
    Allan
  • trimpertrimper Posts: 3Questions: 0Answers: 0
    Stupendous!

    Thank you very much.
This discussion has been closed.