Display row, where column has specific data

Display row, where column has specific data

carlyipcarlyip Posts: 3Questions: 1Answers: 0
edited February 2022 in DataTables

Hi, i want to make a button that has a dropdown, that can display all rows data with specifc data of column

https://pasteboard.co/sB6zCwQKyGLu.png

Etc, display all rows where the column "Technology" is equal to something

how can i make that

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 57,737Questions: 1Answers: 9,204 Site admin
    Answer ✓

    Use a column filter - column().search().

    Allan

  • carlyipcarlyip Posts: 3Questions: 1Answers: 0
    edited February 2022

    Hi i have embeded this lines of code and commented previous code


    var table = $('#table-item').DataTable(); table.columns( '.select-filter' ).every( function () { var that = this; // Create the select list and search operation var select = $('<select />') .appendTo( this.footer() ) .on( 'change', function () { that .search( $(this).val() ) .draw(); } ); // Get the search data for the first column and add to the select list this .cache( 'search' ) .sort() .unique() .each( function ( d ) { select.append( $('<option value="'+d+'">'+d+'</option>') ); } ); } );

    but my page oni display this, nothing display or changed
    https://pasteboard.co/bIjzwFT6wY8g.png

  • carlyipcarlyip Posts: 3Questions: 1Answers: 0
    edited February 2022

    This is my previous code


    $(document).ready( function () { $('#table-item').DataTable(); } );
  • kthorngrenkthorngren Posts: 17,759Questions: 25Answers: 4,216

    This code is appending to the footer:

            .appendTo(
                this.footer()
            )
    

    But your table doesn't have a tfoot. Define a footer for your table.

    Kevin

Sign In or Register to comment.