ranman0049 / jquery-datatables-column-filter

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

column-filter not working with ColVis and bStateSave #35

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Have bStateSave = true
2. Hide columns using ColVis
3. Refresh page
4. Unhide columns
4. The column-filter options will not be in the footer

It looks like if the column is hidden then the filter is not added once the 
column is unhidden. 

Original issue reported on code.google.com by AndrewDM...@gmail.com on 12 Oct 2011 at 7:29

GoogleCodeExporter commented 8 years ago
would be nice if column filter can work with ColVis.

Original comment by joell...@gmail.com on 13 Oct 2011 at 10:42

GoogleCodeExporter commented 8 years ago
Hi,

column filter works with colVis plugin see 
http://jquery-datatables-column-filter.googlecode.com/svn/trunk/colVis.html. 
However, saving state in the cookie does not work. I have tried to implement it 
few times but it messes with original data tables settings so it causes more 
troubles.
Save State functionality is not supported at the moment.

Jovan

Original comment by joc...@gmail.com on 13 Oct 2011 at 11:49

GoogleCodeExporter commented 8 years ago
Jovan, 

So I have to set "bStateSave" = false to ensure that column filter will work 
correctly? I don't want to save the state of the filter, but I would like to 
save the state of the colVis (and other options) for my table. 

I looks like the column filter ignores the hidden columns then renders the 
filters on incorrect column rows.

Thanks

-Andrew

This is what I have at the moment (my table has 16 columns):

    var oTable = $('#SCH_PROD').dataTable({
        "aoColumns":[
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            { "sType": "image" }
        ],
        "bPaginate": false, // DISABLE PAGINATE
        "bProcessing": true, // PROCESSING DISPLAY
        "bStateSave": true, //SAVE STATE
        "bJQueryUI": true,
        "bAutoWidth": true,
        "asStripClasses": true,
        "sDom": '<"H"TRlrC>t<"F"i>',
        "oColVis": {
            "aiExclude": [ 5,8,9,10,11 ]
        },
        "oTableTools": {
            "sSwfPath": "../swf/copy_cvs_xls_pdf.swf",
            "aButtons": [
            {
                "sExtends": "copy",
                "mColumns": "visible"
            },
            {
                "sExtends": "xls",
                "mColumns": "visible"
            },
            {
                "sExtends": "pdf",
                "sPdfOrientation": "landscape",
                "mColumns": "visible"
            },
            {
                "sExtends": "print"
            }
        ]
        }

    });

    oTable.columnFilter({
        aoColumns:[
            null,
            null,
            null,
            null,
            null,
            { type:"date-range"},
            null,
            null,
            { type:"date-range"},
            { type:"date-range"},
            { type:"date-range"},
            { type:"date-range"},
            null,
            null,
            null,
            null
        ]
    });

Original comment by AndrewDM...@gmail.com on 13 Oct 2011 at 12:31

GoogleCodeExporter commented 8 years ago
Another option would be to render the filter on every column regardless of 
visibility but I am unsure how I would do that. 

Original comment by AndrewDM...@gmail.com on 13 Oct 2011 at 2:49

GoogleCodeExporter commented 8 years ago
Hi Jovan,

If saving your state interferes with datatable's cookie, would it be an idea to 
use a second separate cookie? I do all the filtering server side with simple 
text filters, all I'd need is a render of the of the old search box content on 
page revisit.

just my €.02,

Michael

Original comment by Michael....@gmail.com on 12 Dec 2011 at 9:47

GoogleCodeExporter commented 8 years ago
oTable.fnSettings().aoColumns[iCol].nTh
or
oTable.fnSettings().aoColumns[iCol].nTf

are hooks into the header/footer of each column, regardless of visibility. 
Having defaulted invisible columns messing up the filtering is a pretty big 
issue with my usage of this tool.

Original comment by kor...@gmail.com on 6 Jan 2012 at 10:43

GoogleCodeExporter commented 8 years ago
Attached is a patch that fixes the issue when using tfoot. Shouldn't be too 
hard to fix up for the tHeads

Original comment by kor...@gmail.com on 6 Jan 2012 at 11:25

Attachments:

GoogleCodeExporter commented 8 years ago
hello,

could you please tell me on which version the patch has to be run?
(the run of the patch-file on the latest version (r58) failed on my local pc)

thanks and best regards :)

Johannes

Original comment by johannes...@googlemail.com on 9 Jan 2012 at 1:34

GoogleCodeExporter commented 8 years ago
Whoops! Attached the wrong patch, here's the right one, and it also includes a 
patch for #46 as well

Original comment by kor...@gmail.com on 9 Jan 2012 at 7:29

Attachments:

GoogleCodeExporter commented 8 years ago
Hi,

Sorry for the late response. 
Fix provided by kormoc didn't worked in all cases. It works fine with footer 
but in header there are duplicate TH cells one for DataTable sorting events, 
and the other for column filter.
However, I think that I have succeed to fix this issue. Instead of the nTh in 
aoColumns I have used oTable.fnSettings().aoFooter[0] and 
oTable.fnSettings().aoHeader[0] and it seems to me that it works. 
Scenario that is reported by Andrew works on 
http://jquery-datatables-column-filter.googlecode.com/svn/trunk/colVis.html . 

Could you please take a latest version of plugin 1.4.7+ and try in your code?

Thanks,
Jovan

Original comment by joc...@gmail.com on 16 Feb 2012 at 9:08

GoogleCodeExporter commented 8 years ago
This appears to work correctly for my code.

Thanks so much for the fix and the project in general!

Original comment by kor...@gmail.com on 23 Feb 2012 at 5:52

GoogleCodeExporter commented 8 years ago
I'm glad that it works and helps you.

I'm closing this issue.

Original comment by joc...@gmail.com on 29 Feb 2012 at 6:25