Search code examples
javascripthtmlw2ui

How to remove search and refresh fields from W2UI grid toolbar?


The W2UI Grid component has an option to turn on a toolbar. Unfortunately it contains two fields that I don't want and take up space that I don't have. The two fields are the search and refresh. You can see them here.

How do you turn them off? I've tried removing the "searches" items from the w2grid definition options, but yet the search field remains. Has anyone figured out how to hide those two fields?


Solution

  • Those toolbar elements can be hidden via grid.show.

    To remove the search drop-down set toolbarSearch to false.

    To remove the search input field set toolbarInput to false.

    To remove the refresh button set toolbarReload to false.

    Here's the modified show property based on the demo you've linked:

        show: { 
            toolbar: true,
            footer: true,
            toolbarAdd: true,
            toolbarDelete: true,
            toolbarSave: true,
            toolbarEdit: true,
            toolbarSearch: false,
            toolbarInput: false,
            toolbarReload: false,
        },
    

    grid.show documentation can be found here: http://w2ui.com/web/docs/1.5/w2grid.show

    Fiddle: http://jsfiddle.net/g5ebyqdv/