Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81986

seachPanes: Show pane by column name, not ordinal position

$
0
0

Hi

I created a test case to demonstrate my problem but there is a script error so I can't show my issue. Test case is here live.datatables.net/kupizova/1/edit

All I want to do is show and hide panes based on their name, not the column position in the table. This is because the user can reOrder columns.

In my real world project, the searchPanes are ok and displayed in either a modal or a sidebar (user choice) but some panes like a telephone number or email address do not and should not be available for filtering because there would only ever be one. By rights, it should automatically be excluded from the panes because of the uniqueness.

If you were to apply this: -

$(document).ready(function() {
    $('#example').DataTable( {
        searchPanes:true,
        dom: 'Pfrtip',
        columnDefs:[
            {
                searchPanes:{
                    show: true,
                },
                targets: [0],
            },
            {
                searchPanes:{
                    show: false,
                },
                targets: [2],
            }
        ]
    });
});

Then pane 2 would not be shown

I want to replace targets: [2] with `targets: ['name:telephone', 'name:email']'

Is this possible?

Edited by Kevin:  Syntax highlighting. Details on how to highlight code using markdown can be found in this guide


Viewing all articles
Browse latest Browse all 81986

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>