{% extends "partials/layouts/main-layout.html.twig" %} {% block css1 %} {% endblock %} {% block body_attributes %}
{% endblock %} {% block sidebar %} {% include "partials/sidebar.html.twig" %} {% endblock %} {% block hr_sidebar %} {% include "partials/horizontal-sidebar.html.twig" %} {% endblock %} {% block content %}
To use add select2
class in select tag.
To use add selected
to any particuler menu.
To use add give Pertage to the
select
tag.
Select2 supports displaying a placeholder value using the
placeholder
configuration option. The placeholder value will be displayed until a selection is made.
Select2 will correctly handle disabled options, both with data coming from a standard select (when the
disabled
attribute is set) and from remote sources, where the object has disabled: true set.
Select2 allows you to hide the search box using the
minimumResultsForSearch
configuration option. In this example, we use the value
Infinity
to tell Select2 to never display the search box.
Select2 also support for mulitple select option.The select below is declared with the multiple attribute.
To add use .select2
class for basic select2 control and additionally use
multiple="multiple"
attribute for multiple select box.
To use add give Pertage to the
select
tag.
Select2 will correctly handle
disabled
options, both with data coming from a standard select (when the disabled attribute is set) and from remote sources, where the object has disabled: true set.
To use add select2-max-length
id in select tag.
You may use the data configuration option to load dropdown options from a local array. You can provide initial selections with array data by providing the option tag for the selected values, similar to how it would be done for a standard select.
Select2 comes with AJAX support built in, using jQuery's AJAX methods. In this example, we can search for repositories using GitHub's API.
Select2 can load message translations for different languages from language files. When using translations provided by Select2, you must make sure to include the translation file in your page after Select2.The language does not have to be defined when Select2 is being initialized, but instead can be defined in the
[lang]
attribute of any parent elements as
[lang="es"]
.
Select2 supports custom themes using the theme option so you can style Select2 to match the rest of your application. These are using the classic theme, which matches the old look of Select2.
To use add data-flag
to set icon with menu and use class
template-with-flag-icons
in the select tag.
Tagging can also be used in multi-value select boxes. In the example below, we set the multiple="multiple" attribute on a Select2 control that also has
tags: true
enabled.
The separators that should be used when tokenizing can be specified using the tokenSeparators options. select2 supports ability to add choices automatically as the user is typing into the search field.
When users filter down the results by entering search terms into the search box, Select2 uses an internal "matcher" to match search terms to results. You may customize the way that Select2 matches search terms by specifying a callback for the
matcher
configuration option.
Select2 will work on RTL websites if the dir attribute is set on the
<select>
or any parents of it. You can also initialize Select2 with
dir: "rtl"
set.
Select2 can load message translations for different languages from language files. When using translations provided by Select2, you must make sure to include the translation file in your page after Select2.The language does not have to be defined when Select2 is being initialized, but instead can be defined in the [lang] attribute of any parent elements as
[lang="es"]
.
To use add js-events
class in the select tag and it will fire event when you click on the select and choose any option and finally close it.
To use add js-events
class in the select tag and it will fire event when you click on the select and choose any option and finally close it.
select2 also supports for programmatic access.To create new options can be added to a Select2 control programmatically by creating a new Javascript Option object and appending it to the control
To use add class
.select2-with-bg
with
data-bgcolor
&
data-bgcolor-variation
attributes for background color of control.
To use add class
.select2-with-menu-bg
with
data-bgcolor
&
data-bgcolor-variation
attributes for Menu Background color.
To use add class
.select2-with-full-bg
with
data-bgcolor
&
data-bgcolor-variation
attributes for full select2 control background color.
To use add class
.select2-with-border
with
data-border-color
& data-border-variation attributes class for Border color of control.
To use add class
.select2-with-bg
with
data-bgcolor
&
data-bgcolor-variation
attributes for background color of control.
To use add class
.select2-with-menu-bg
with
data-bgcolor
&
data-bgcolor-variation
attributes for Menu Background color.
To use add class
.select2-with-full-bg
with
data-bgcolor
&
data-bgcolor-variation
attributes for full select2 control background color.
To use add class
.select2-with-border
with
data-border-color
& data-border-variation attributes class for Border color of control.