简体   繁体   中英

How to hide/remove filters button from bs_grid

I am using bs_grid to present data from DB. I want to hide the default filters button since I don't use it but it seems difficul to find any previous question or some indication.

Any help is appreciated.

EDIT: The jquery plugin use a single div to present all the grid wich is calculate based on some initial settings

HTML Code:

<div id="cliente_grid"></div>

JS Code:

$(function() {

$("#cliente_grid").bs_grid({

    ajaxFetchDataURL: "ajax/ajax_fetch_cliente_data.php",
    row_primary_key: "ID_anagrafica_clienti",
    columns: [
        {field: "ID_anagrafica_clienti", header: "Code", visible: "no"},
        {field: "Codice_Fiscale", header: "Codice Fiscale"},
        {field: "Cognome", header: "Cognome"},
        {field: "Nome", header: "Nome"},
        {field: "Sesso", header: "Sesso"},
        {field: "Data_nascita", header: "Data nascita"},
        {field: "Comune_nascita", header: "Comune nascita", visible: "no"},
        {field: "Pv_nascita", header: "Pv nascita", visible: "no"}
    ],

    sorting: [
        {sortingName: "Code", field: "ID_anagrafica_clienti", order: "none"},
        {sortingName: "Codice Fiscale", field: "Codice_Fiscale", order: "ascending"},
        {sortingName: "Cognome", field: "Cognome", order: "ascending"},
        {sortingName: "Nome", field: "Nome", order: "ascending"},
        {sortingName: "Sesso", field: "Sesso", order: "ascending"},
        {sortingName: "Data nascita", field: "Data_nascita", order: "none"},
        {sortingName: "Comune nascita", field: "Comune_nascita", order: "ascending"},
        {sortingName: "Pv nascita", field: "Pv_nascita", order: "ascending"}
    ],
 /*
    filterOptions: {
        filters: [
            {
                filterName: "Codice_Fiscale", "filterType": "text", field: "Codice_Fiscale", filterLabel: "Codice Fiscale",
                excluded_operators: ["in", "not_in"],
                filter_interface: [
                    {
                        filter_element: "input",
                        filter_element_attributes: {"type": "text"}
                    }
                ]
            },
            {
                filterName: "Cognome", "filterType": "text",field: "Cognome", filterLabel: "Cognome",
                excluded_operators: ["equal", "not_equal", "less", "less_or_equal", "greater", "greater_or_equal"],
                filter_interface: [
                    {
                        filter_element: "input",
                        filter_element_attributes: {type: "text"}
                    }
                ],
            },
            {
                filterName: "Gender", "filterType": "number", "numberType": "integer", field: "lk_genders_id", filterLabel: "Gender",
                excluded_operators: ["equal", "not_equal", "less", "less_or_equal", "greater", "greater_or_equal"],
                filter_interface: [
                    {
                        filter_element: "input",
                        filter_element_attributes: {type: "checkbox"}
                    }
                ],
                lookup_values: [
                    {lk_option: "Male", lk_value: "1"},
                    {lk_option: "Female", lk_value: "2", lk_selected: "yes"}
                ]
            },

            {
                filterName: "DateUpdated", "filterType": "date", field: "date_updated", filterLabel: "Datetime updated",
                excluded_operators: ["in", "not_in"],
                filter_interface: [
                    {
                        filter_element: "input",
                        filter_element_attributes: {
                            type: "text",
                            title: "Set the date and time using format: dd/mm/yyyy hh:mm:ss"
                        },
                        filter_widget: "datetimepicker",
                        filter_widget_properties: {
                            dateFormat: "dd/mm/yy",
                            timeFormat: "HH:mm:ss",
                            changeMonth: true,
                            changeYear: true,
                            showSecond: true
                        }
                    }
                ],
                validate_dateformat: ["DD/MM/YYYY HH:mm:ss"],
                filter_value_conversion: {
                    function_name: "local_datetime_to_UTC_timestamp",
                    args: [
                        {"filter_value": "yes"},
                        {"value": "DD/MM/YYYY HH:mm:ss"}
                    ]
                }
            }
        ]
    }
    */
});

});

as can be seen in the code there is not any indication, some property or whatever, and on the siite there are not as well (i searched them for long time but never founded, maybe i'm wrong? )

I analyzed the html code produced by the plugin

<button id="filter_toggle_cliente_grid" class="btn btn-default pull-right" title="Filters"><span class="glyphicon glyphicon-filter"></span></button>

I found a workaround that solves my problem. I used css to hide the button. here is the code

#filter_toggle_cliente_grid {
    display: none;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM