Quantcast
Channel: DataTables 1.10 — DataTables forums
Viewing all articles
Browse latest Browse all 2364

Individual column search with select input: fetch all column aggregated data from database

$
0
0

Hi,
following this https://datatables.net/examples/api/multi_filter_select.html example with a server-side table, and having this code:

            this.api().columns('.selectSearch').every( function () {
                var column = this;
                var select = $('<select><option value=""></option></select>')
                        .appendTo( $(column.footer()).empty() )
                        .on( 'change', function () {
                            var val = $.fn.dataTable.util.escapeRegex(
                                    $(this).val()
                            );

                            column
                                    .search( val ? '^'+val+'$' : '', true, false )
                                    .draw();
                        } );

                column.data().unique().sort().each( function ( d, j ) {
                    select.append( '<option value="'+d+'">'+d+'</option>' )
                } );
            } );

The select field is populated with the paginated records, but i would like to have every record from database and not just the ones I'm seeing, so I think I need to perform another query to aggregate data.

Would it be possible?
Thank you
Alex


Viewing all articles
Browse latest Browse all 2364

Trending Articles