Two dataTables with search fields, want to search buttons for each table.

Two dataTables with search fields, want to search buttons for each table.

ac2305ac2305 Posts: 2Questions: 1Answers: 0
edited January 2020 in Free community support

I have tried several things and they seem to overlap when I select search on one:-

_initComplete : function($table) {
        //var input = $('.dataTables_filter input').unbind(),
        var input = $table.unbind();
          self = $table.api(),
          $searchButton = $('<button>')
            .text('Search')
            .click(function() {
              self.search(input.val()).draw();
            }),
          $clearButton = $('<button>')
            .text('Clear')
            .click(function() {
              input.val('');
              $searchButton.click();
            })
        //$('.dataTables_filter').append($searchButton, $clearButton);
        $table.append($searchButton, $clearButton);
        
        //failed attempts to add using the table ids.
        //$table.attr("id", "non_validated_list").append($searchButton, $clearButton)
        //$("#vendor_list").append($searchButton, $clearButton);
        //$("#non_validated_list").append($searchButton, $clearButton);

Any Ideas?

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

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • ac2305ac2305 Posts: 2Questions: 1Answers: 0
    edited January 2020

    Thank you for the advise Colin.

    I will update with a test case.

This discussion has been closed.