Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I hide the search box on the jquery-bootgrid table?

Tags:

jquery

I can't find an option to hide the search box.

Is there an option ?

Should I be doing that by setting the class to hidden via Javascript?

Thanks, F

like image 958
fergal_dd Avatar asked Nov 29 '22 23:11

fergal_dd


2 Answers

I don't know if this is the best solution but you can add an empty string for the search template

$(...).bootgrid({
    // ...
    templates: {
        search: ""
    }
});
like image 184
Andreas Avatar answered Dec 18 '22 20:12

Andreas


I guess the Andreas answer is better for you, but also you can override the header of your table with the:

$("#grid").bootgrid({
    templates: {
        header: "<your header>"    
    }
});

More explanations are here: https://github.com/rstaib/jquery-bootgrid/issues/82

So the default header template is:

header: "<div id=\"{{ctx.id}}\" class=\"{{css.header}}\">
<div class=\"row\"><div class=\"col-sm-12 actionBar\"><p class=\"
{{css.search}}\"></p><p class=\"{{css.actions}}\"></p></div></div></div>"

You can find it in the source code where all default templates are defined (it is about 1210 row number of the jquery.bootgrid.js file).

In your case you just need to take original header, override it in your bootgrid settings and there hide or remove (if you need) or set the extra id or css class to the: <p class=\"{{css.search}}\"></p>.

like image 44
Alexander Avatar answered Dec 18 '22 22:12

Alexander