Adding .change() to filter input

Adding .change() to filter input

bcraigbcraig Posts: 8Questions: 2Answers: 0
edited June 2014 in Free community support

With my filter input for my datatable I have suggestions that appear below on .keyup() such like autocomplete. When clicking on a suggestion this changes the value of the filter input. How can I attach this event to update my datatable?

        if($(this).val().length !=0){
                $(this).next().fadeTo("slow", 1.0).css({cursor:"default"}); // fades in suggestion container
        suggestion(this, $(this).attr('tables')); // calls function that retrieves suggestions from database
        } else {
                $(this).next().fadeTo("slow", 0).css({cursor:"default"}); // input empty, no suggestions

Would I insert somewhere above: onchange - trigger filter update.

OR maybe I would put a trigger in my suggestion click function?

        $("#filterInput").value() = value;

    $('#filterInput').on('change', function() {
        var oTable = $('#table').dataTable();

OR would I add this trigger in the datatable call.. $('#table').DataTable();


  • bcraigbcraig Posts: 8Questions: 2Answers: 0

    This alert is actioned but table is not updated with the inputs new;y set value.

    $('#table').DataTable({""fnDrawCallback": function( oSettings ) {                                 alert( 'DataTables has redrawn the table' );
        var parent = "#"+$(this).attr("parent");
        var suggestedValue = $(this).text();
        inputID.value = suggestedValue;
  • bcraigbcraig Posts: 8Questions: 2Answers: 0
    edited June 2014

    Solved this myself..

This discussion has been closed.