stefanocudini / bootstrap-list-filter

Search widget to filter Bootstrap lists
https://opengeo.tech/bootstrap-list-filter/
MIT License
99 stars 31 forks source link

Ability to clear filter input with a button #18

Closed kevkha closed 9 years ago

kevkha commented 9 years ago

I have a button to clear the filter input. The input's value is clear but it does not trigger the event until I actually click on the input and press a backspace key.

kevkha commented 9 years ago

I created this workaround to simulate a backspace key press and it seems to work.

    $(document).on('click','button.search-clear',function() {
        var e = jQuery.Event('keyup', { keyCode: 8 });
        $(this).closest('div').find('input[type=search]').val('').trigger(e);
    });
stefanocudini commented 9 years ago

I'm just added this new feature, try it here: http://labs.easyblog.it/bootstrap-list-filter/examples/cancel-button.html

update to version 0.2.2

kevkha commented 9 years ago

Very :+1: Thanks!