rifanece / jquery-datatables-column-filter

Automatically exported from code.google.com/p/jquery-datatables-column-filter
0 stars 0 forks source link

INFO NEEDED - columnFilter is incompatible with ColVis, solution inclosed #23

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Setup a datable with columnFilter and colVis 
2. Hide one or more columns
3. Try to filter and errors will be generated

The solution is to look for all oTable.fnFilter() instances and in each case 
replace the 'index' variable with:
oTable.oApi._fnVisibleToColumnIndex(oTable.fnSettings(),index)

For example, replace:
oTable.fnFilter($(this).val(), index);
with:
oTable.fnFilter($(this).val(), 
oTable.oApi._fnVisibleToColumnIndex(oTable.fnSettings(),index));

Basically filtering should occur only on Visible columns, not all columns.

Original issue reported on code.google.com by g.duerrm...@gmail.com on 29 Jul 2011 at 3:15

GoogleCodeExporter commented 9 years ago
There is actually one more modification which is necessary. In the function     
    fnCreateRangeInput() one must account for hidden/absent elements.
Replace:
                if (oTable.attr("id") != oSettings.sTableId)
                    return true;

With:
                if ((oTable.attr("id") != oSettings.sTableId) || (!document.getElementById(sFromId)) || (!document.getElementById(sToId))) {
                    return true;
                    }

Original comment by g.duerrm...@gmail.com on 29 Jul 2011 at 5:40

GoogleCodeExporter commented 9 years ago
Hi,

Thanks for this code, I believe that it has resolved issue you have found but I 
cannot add it in the main code until I reproduce bug. I have placed example 
where I have included colVis plugin and everything works fine see 
http://jquery-datatables-column-filter.googlecode.com/svn/trunk/colVis.html. 
Could you show me there what is scenario where you have found the bug?

Regards,
Jovan 

Original comment by joc...@gmail.com on 25 Sep 2011 at 9:38

GoogleCodeExporter commented 9 years ago
Issue 15 has been merged into this issue.

Original comment by joc...@gmail.com on 25 Sep 2011 at 9:43

GoogleCodeExporter commented 9 years ago
Please reopen this issue if you can show me example where it does not work.

Jovan

Original comment by joc...@gmail.com on 30 Sep 2011 at 3:57

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
As  Issue 15  has been merged with this one, I thought I'd post my experiences 
here. I've put together a sample here http://jsfiddle.net/JAafE/2/ which 
demonstrates the problem as I've run into it. I've set up two filters, a 
text-based one on the 'Browsers' column and a select list on the 'CSS Grade' 
column.

However, as the rendered table shows, the 'text' filter has been placed 
underneath the 'Platform(s)' column and the 'select' filter does not even show 
up...instead only showing the 'CSS grade' footer text. The reason for this is 
that the ColumnFilter plugin does not account for columns hidden via the 
'bVisible' flag. It assumes the index in the 'aoColumns' parameter passed in is 
the visible index for the column to add the filter to, rather than the actual 
index for columns.

As mentioned by the original poster, using _fnVisibleToColumnIndex() when 
working with column indices fixes this problem.

Original comment by beckkenn...@gmail.com on 3 Oct 2011 at 6:49