Custom Panes only - How to combine selected filters and computes matching results

Custom Panes only - How to combine selected filters and computes matching results

chimouchimou Posts: 9Questions: 0Answers: 0
edited August 2022 in Free community support

Hello,

I do not find a way to automatically compute matching results counter (in the others custom panes) each time a filter is selected from a custom pane.

it is my table definition :

        let table = $('#table_users').DataTable
        ({
            ajax: {
                url: '$url',
                type: 'POST',
                data: { status: 'all' },
                dataSrc: ''
            },
            columns: [
                { data: 'type' },
                { data: 'user' },
                { data: 'status' },
                { data: 'risk'},
                { data: 'date' }
            ],
            columnDefs: [ { "className": "dt-center", "targets": "_all" }, { searchPanes: { show: false }, targets: ['_all'] }  ],
            language: { url: "https://cdn.datatables.net/plug-ins/1.12.1/i18n/fr-FR.json" },
            buttons: [{
                extend: 'searchPanes',
                config: {
                    order: ['status', 'risk', 'country'],
                    panes: [
                        {
                            name: 'risk',
                            header: 'Niveau de risque',
                            options: [ { label: "Faible", value: function(rowData, rowIdx){ return rowData.final_risk == '0.25'; } },
                                   { label: "Moyen", value: function(rowData, rowIdx){ return rowData.final_risk == '0.5'; } }
                            ],
                            dtOpts:{ searching: true, order: [[1, 'desc']] }
                        },
                        {
                            name: 'status',
                            header: 'Statut',
                            options: [ { label: "OK", value: function(rowData, rowIdx){ return rowData.status == '1'; } },
                                   { label: "NOT OK", value: function(rowData, rowIdx){ return rowData.status == '2'; } },
                                   { label: "WAITING", value: function(rowData, rowIdx){ return rowData.status == '3'; } }
                            ],
                            dtOpts:{ searching: true, order: [[1, 'desc']] }
                        },
                        {
                            name: 'country',
                            header: 'Pays',
                            options: [ { label: "France", value: function(rowData, rowIdx){ return rowData.country == 'FR'; } },
                                   { label: "États-Unis", value: function(rowData, rowIdx){ return rowData.country == 'US'; } },
                                   { label: "Australie", value: function(rowData, rowIdx){ return rowData.country == 'AU'; } }
                            ],
                            dtOpts:{ searching: true, order: [[1, 'desc']] }
                        }
                    ],
                    layout: 'columns-3'
                }
            }],
            dom: 'Bfrtip'
        });

Thank you for your support.

Sign In or Register to comment.