Searchpanes not hiding filters for certain columns

Searchpanes not hiding filters for certain columns

colbycolby Posts: 10Questions: 5Answers: 0
edited March 2020 in SearchPanes

Hey,

first of all, thank you for a great extension. I'm having some issues hiding filters for certain columns though.
This is my init code:

table.DataTable({
            responsive: true,
            dom: 'PBfrtip',
            searchPanes: true,
            buttons: [
                'print',
                {
                    extend: 'excelHtml5',
                    title: '',
                    filename: function(){
                        var d = new Date();
                        var n = d.getTime();
                        return 'ExportProducts - ' + moment().format('DD-MM-YYYY H-mm-ss');
                    },
                    exportOptions: {
                        columns: ':visible',
                        modifier: { order: 'index' },
                        format: {
                            body: function(data, row, column, node) {
                                return data.replace(' €', '');
                            }
                        }
                    },
                    text: 'Save as Excel',
                    customize: function( xlsx ) {
                        var sheet = xlsx.xl.worksheets['sheet1.xml'];
                        //$('row c[r^="A"]', sheet).attr( 's', '50' );
                        $('row c[r^="E"]', sheet).attr( 's', '51' );
                        $('row c[r^="F"]', sheet).attr( 's', '51' );
                        $('row c[r^="G"]', sheet).attr( 's', '51' );
                    }
                },
                'pdfHtml5'
            ],
            
            keys: {
                columns: [5],
                editor: editor,
                editOnFocus: true
            },
            searchDelay: 500,
            stateSave: true,
            fixedHeader: true,
            pageLength: 50,
            lengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
            processing: true,
            ajax: '/script/exportProductsClient.php',
            columnDefs:[
                {
                    searchPanes:{
                        show: false
                    },
                    targets: [0],
                },
                {
                    searchPanes:{
                        show: false
                    },
                    targets: [3],
                },
                {
                    searchPanes:{
                        show: false
                    },
                    targets: [4],
                },
                {
                    searchPanes:{
                        show: false
                    },
                    targets: [5],
                },
                {
                    searchPanes:{
                        show: false
                    },
                    targets: [6],
                }
            ],
            columns: [
                {data: 'EAN'},
                {data: 'Vendor'},
                {data: 'Format'},
                {data: 'Description'},
                {data: 'Qty'},
                {
                    data: 'ExportPrice',
                    className: 'editable',
                    render: function ( data, type, row, meta ) {
                        return data+' €';
                    }

                },
                {
                    data: 'BuyPrice',
                    render: function ( data, type, row, meta ) {
                        return data+' €';
                    }
                },
                {data: 'Status'},
            //  {data: 'Actions', responsivePriority: -1},
            ],
            
        });
        
    };

Only the filter for the first and the 4th columns are hidden. Anyone can see what could be the cause of it? I first thought it was because of render functions, but Qty doesn't have that and it's showing...

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,144Questions: 26Answers: 4,736
    Answer ✓

    I put your basic SearchPanes config together here and its working:
    http://live.datatables.net/fafuhiqi/1/edit

    Are you using the latest version of SearchPanes? There have been quite a few fixes put into the latest version.

    Kevin

  • colbycolby Posts: 10Questions: 5Answers: 0

    Hey, thank you for answering. Yes, I'm using the latest, just downloaded it today.
    I just tried it in a different browser and it works...looks like Chrome has some weird caching thing going on...anyone seen that? I change the call of JS with a time parameter behind it and it still loads the first JS version loaded.

    Thank you...works as it should.

This discussion has been closed.