Jerusalem is the first qibla of Muslims and the capital of Palestine.

Bootstrap Filter Plugin

29.03.2022 | min read

Instead of the form elements being displayed side by side, it allows the form element to be displayed with the user action.

Bootstrap Filter Plugin Demo
Sample Image

Basic Form Elements

This use is recommended if the filter contains classic form elements (text, radio, checkbox, select-one or select-multiple). Click for sample page.

HTML

The "data-filter" feature is added to the buttons. The name of the filter is given as a value.

The "data-filter-container" feature is added to the containers that will be opened when the buttons are clicked. The name of the filter is given as a value.

The container may include the form elements of text, radio, checkbox, select-one or select-multiple.

JS

JSON object is created that contains the filter's name, label, default text and default value.
The JSON key must be the same with the "data-filter value" which is added to HTML.

nameThe name of the form element in the container is indicated.
labelIt is used to show the name of the filter in the filter button.
defaultTextIt is used to show the default text in the filter button if there is no selection in the form element.
defaultValueIt specifies the value that will be selected in the form element when the reset button or the clear filter button is clicked.

Custom Form Elements

This use is recommended if the filter contains more than one form element or different components. Click for sample page

JS

Three methods are defined for each filter.
The method that returns the text of the filter is defined as "getText".
The method that returns the value of the filter is defined as "getValue".
The method to be called to clear the filter is defined as "clearValue".
The JSON key must be the same as the data-filter value added in HTML.

Handle Events

This use is recommended if an event triggering is requested when the apply or reset buttons are clicked. Click for sample page

JS

Two methods are defined.
The method to be called when the reset button is clicked is defined as "clickedFilterResetButton".
The method to be called when the Apply button is clicked is defined as "clickedFilterApplyButton".
Filter values are passed as parameters (payload) to "clickedFilterApplyButton" method in JSON format.

You can access source code and samples from Github.

ahmetkucukoglu/bootstrap-filter-plugin

Form elementlerinin yan yana gösterilmesi yerine kullanıcı aksiyonu ile form elementinin gösterilmesini sağlar.

HTML
2
1

Share This Post

Leave a comment

Reply to

Cancel reply
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Your comment has been sent successfully reCaptcha couldn't be verified
Made with ASP.NET Core