sort select

sort select

sairus95sairus95 Posts: 5Questions: 2Answers: 0
edited January 2021 in Free community support

Hello,
I want to reduce the results of each select as and when the selections remove the results not available. I can't do it !! can you help me thank you

                            function (){
                                this.api().columns([3,4,5,6,7,8,9,10,11]).every( function (){
                                    var column = this;
                                    var select = $('<select class="form-control selectpicker show-menu-arrow form" data-live-search="true"><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>' )
                                    });
                                });
                            }

Replies

This discussion has been closed.