Sitelet https://web.archive.org/web/20200914203435/https://github.com/Mobius1/Vanilla-DataTables/issues/48
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I suggest to add a "clear" button next to the "search/filter" input box #48

Open
BarbiBimbo opened this issue Dec 7, 2017 · 0 comments
Open

Comments

@BarbiBimbo
Copy link

@BarbiBimbo BarbiBimbo commented Dec 7, 2017

I suggest another change... this will insert a "clear" button next to the search term.. most people will find it normal to have that. Plus is it inconvenient having to "backspace" to clear a search term.

image

=================================================================

        // Search input
        if ( o.searchable ) {
                that.input = that.wrapper.querySelector(".dataTable-input");
                if ( that.input ) {
                        util.on(that.input, 'keyup', function(e) {
                                that.search(this.value);
                        });

             // new button
            /////////////////////////////////////////////////
            that.clearform = that.wrapper.querySelector(".dataTable-clear");
                if ( that.clearform ) {
                                util.on(that.clearform, 'click', function(e) {
                                                that.input.value='';
                                                this.value='';
                                                that.search(this.value);
                                });


                }


                }

        }

=================================================================

        // Searchable
        if (o.searchable) {
                var sNull = '';

                // Changed the next line
                ///////////////////////////////////////////////////////////////
               var form = "<div class='dataTable-search'><input class='dataTable-input' placeholder='"+o.labels.placeholder+"' type='text'><button class='dataTable-input dataTable-clear'>Clear</button></div>";

                // Search input placement
                template = template.replace("{search}", form);
        } else {
                template = template.replace("{search}", "");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.