1
0
mirror of synced 2024-11-22 21:16:10 +03:00
Commit Graph

787 Commits

Author SHA1 Message Date
Matthias Kurz
bd3bd55719 Allow chaining for .select2('readonly', ...) 2014-02-03 16:07:23 +01:00
Coleman Watts
175c78441f Accept strings as well as functions for localization 2014-01-31 21:04:36 -08:00
Jeanmonod David
ed77cab7d5 Allow to display item created by createSearchChoice at the end of the list
ref #595
2014-01-24 18:54:56 +01:00
jdecuyper
c87615f14c The function hideSelectionFromResult was tested against undefined as a property and not as a function 2014-01-21 11:45:13 -06:00
Kevin Brown
0f1372ce72 Merge pull request #1733 from flyerhzm/append-label-only-when-formatted-defined
append label only when formatted is not undefined
2014-01-21 05:49:36 -08:00
Marchenko Alexandr
89ae701691 merge 2014-01-21 12:17:58 +02:00
Marchenko Alexandr
2e901f79a1 merge 2014-01-21 11:54:48 +02:00
Kevin Brown
e559f92c35 Merge pull request #2001 from arendjr/master
Don't rely on :visible and :not(..., ...) selectors which only work with Sizzle
2014-01-20 16:48:27 -08:00
Marchenko Alexandr
f4886a0afa Optional Search Input Placeholder parameter added 2014-01-20 11:38:33 +02:00
jdecuyper
84cf134a4e Add hideSelectionFromResult function 2014-01-19 21:12:39 -06:00
Tim Robertson
eaf09c7f76 Accessibility updates based on jQuery UI Autocomplete 2014-01-19 18:52:56 -05:00
Sebastian Kather
48d392635f singleSelect: setting nextSearchTerm in initSelection
For single select the nextSearchTerm callback is called when
initSelection returned data
2014-01-16 16:12:00 +01:00
Steven Armstrong
829b8c7346 Changed default text for min number of characters.
Use to read:
Please enter 3 more characters.
Now reads:
Please enter 3 or more characters.
2014-01-13 10:01:30 -05:00
Jonathan Potter
4dce487ccb Prevent IE from generating unwanted clicks on the body. When mousedown fires on the selection element and then mouseup fires on the mask (because it is moved under the mouse during mousedown) then IE fires a click event on the body because it is the closest common ancestor. To prevent this, we detach and reatach the elements on mousedown which cancels the click event. 2014-01-09 11:30:48 -05:00
Igor Vaynberg
3e5ad1334e Merge pull request #2020 from merkuriy/master
L10n files improved
2014-01-08 15:05:23 -08:00
pj
c22bdd41a0 Removed hardcoded class names from $.fn.select2. The code now uses the exports accessible through window.Select2 to instantiate widgets, allowing the environment to replace or extend those classes globally. 2014-01-08 18:09:14 +02:00
pj
41c3d4cfc4 Removed hardcoded class names from $.fn.select2. The code now uses the exports accessible through window.Select2 to instantiate widgets, allowing the environment to replace or extend those classes globally. 2014-01-08 17:56:23 +02:00
Uriy Efremochkin
fd97e585d7 L10n files and template l10n file were improved: Groups of three characters "." (dots) were replaced by a single character "…" (ellipsis). 2014-01-08 15:35:47 +06:00
Kevin Brown
4eb1370b9c Merge pull request #1981 from openwide-java/fix-1946-hard_coded_title
Fix #1946: remove an hard coded title attribute.
2014-01-06 18:01:47 -08:00
jdecuyper
c7dd8c5179 Enable nextSearchTerm function for multiple select 2013-12-31 12:01:48 -06:00
Arend van Beelen
a6ec8fc4e1 Don't rely on :visible and :not(..., ...) selectors which only work with Sizzle. 2013-12-30 15:33:46 +01:00
jibwa
92357e61b8 Fix problem with positioning the dropdown when it is on the right hand side of view
In the stable version this line looks like:

dropLeft = offset.left + width - dropWidth;

In line (1193) the variable width is set to dropWidth which means we are always going to end up with 

dropLeft = offset.left + X - X
or
dropLeft = offset.left

Which means we are still aligned to the left of the button.

This current solution from @ef9f1dea is just aligning the select2-drop closer to the center which is not what it did before the dropdownAutoWidth.


The line I submitted worked perfect and my dropdown now aligns to the RHS of the button again as expected.
2013-12-18 16:28:40 -05:00
Guillaume Smet
3d2b91bd7a Fix #1946: remove an hard coded title.
The original title is copied if defined and it's sufficient for accessibility purpose.
We shouldn't force the title attribute, it's especially annoying if people are using
tooltip implementation based on the title attribute such as Bootstrap tooltip.
2013-12-17 17:03:10 +01:00
Igor Vaynberg
c186dc826e better handling for ipads. fixes #1949 2013-12-03 10:21:17 -08:00
Lito
abe7777b0a Fixed string used as regular expression for ID attribute.
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2013-12-03 08:32:27 -08:00
Igor Vaynberg
fc5ac5b137 Merge pull request #1728 from corinnaerin/master
Compatibility with jQuery 1.9 +
2013-11-29 22:49:06 -08:00
Igor Vaynberg
f8dda91171 Merge pull request #1014 from sjschukin/patch-1
.select2("data", null) causes an error
2013-11-29 22:40:52 -08:00
Igor Vaynberg
aa0fb730aa Merge pull request #1938 from datapad/data-result-direct-children
Only pick up direct children when retrieving data in 'multiple' mode
2013-11-29 22:24:32 -08:00
Igor Vaynberg
816a46bf1a Merge pull request #1940 from datapad/reset-filtered-dropdown
Fix dropdown items not being reset after filtering and selecting when `closeOnSelect` is `false`
2013-11-29 22:24:05 -08:00
Alek Storm
b5aa4688ea Fix dropdown items not being reset after filtering and selecting when closeOnSelect is false 2013-11-27 17:24:11 -06:00
Alek Storm
e7bd3a3779 Only pick up direct children when retrieving data in 'multiple' mode:
Prevents accidentally returning the selected items of any select2's embedded in the HTML of
this selection's items.
2013-11-27 17:17:15 -06:00
riatiger
50f813c003 fix for Uncaught TypeError
Prevents "Uncaught TypeError: Object #<Object> has no method 'abort'"
error for case when non-jQuery promise is used as a handler (AngularJS
$promise for example).
2013-11-21 19:58:01 +02:00
Igor Vaynberg
0967c67776 Merge pull request #1865 from pborreli/typos
Fixed typos
2013-11-14 08:24:38 -08:00
Jake
ef9f1dea90 Fix for drop-auto-width collision detection and css border top
- collision detection was not moving the drop left based on the
difference between viewport and relative location of box (dropleft +
dropwidth)
- .select2-drop-active was overriding the .select2-drop-auto-width
making the shifted dropbox look a bit wierd
2013-11-07 16:21:52 -05:00
Igor Vaynberg
cb5b684ae5 Merge pull request #1887 from lukinpark/patch-1
Update select2.js
2013-11-07 10:09:07 -08:00
Igor Vaynberg
50698fd51c Merge pull request #1685 from jdecuyper/feature-enable-formatResultCssClass
Enable function formatResultCssClass.
2013-11-07 09:51:38 -08:00
Igor Vaynberg
fc4bbbb5ef Merge pull request #1846 from tpruvot/master
issue #1778: prevent delayed focus when the list is hidden
2013-11-07 07:40:45 -08:00
lukinpark
85de8cc1d6 Update select2.js
above function doesn't work great
2013-11-07 11:45:05 +01:00
Jonathan Mahoney
78ccc05e04 Accessibility enhancements for single-value elements. Added correct ARIA attributes and associations. Much-improved screen-reader support (tested with NVDA on Firefox 25) 2013-11-06 12:55:12 +00:00
Pascal Borreli
9725363ada Fixed typos 2013-10-31 23:20:45 +00:00
Max Bruchmann
2d13c0a00a fixed invalid index in buildChangeDetails, fixes #1858 2013-10-31 17:55:19 +01:00
Tanguy Pruvot
b757fb987d issue #1778: prevent delayed focus when the list is hidden
This reset the focus color when the TAB key is pressed.
2013-10-28 11:37:45 +01:00
Igor Vaynberg
cb7aefaeda fix keyboard removal of choices. fixes #1839 2013-10-26 07:57:53 -07:00
Riley Lynch
53d1fea248 Modified syncCssClasses to use output of adapter when applying a class rather than applying the original class 2013-10-20 13:14:31 -07:00
cmcnulty
d5297ccd6d #1807 add support for MutationObserver
Better support mutation events in Firefox
2013-10-17 15:09:02 -05:00
Bob Renwick
8e46faa1d9 Fixing reference to undefined this triggering change on multiselect 2013-10-16 18:30:58 +01:00
Arend van Beelen
fc44b96e84 Don't rely on :selected, makes Select2 compatible with jQuery builds without Sizzle. 2013-10-14 14:37:41 +02:00
stan
2a9154e0c7 Remove unused var declarations 2013-10-10 20:15:26 +02:00
Igor Vaynberg
d1f51910ee small cleanup in width regex matching. #1557 2013-10-09 08:30:26 -07:00
Igor Vaynberg
58f939ef3b Merge pull request #1774 from avelis/master
Fix for #1518. Update to select2.js to trigger properly named event.
2013-10-08 20:35:55 -07:00
Igor Vaynberg
2982be4ec9 fixes #1557 ...again... 2013-10-08 20:33:14 -07:00
Igor Vaynberg
0d0882942f Merge pull request #1639 from francoispluchino/fix-close-focus
Fix the focus when list is closed on the mouse click event
2013-10-08 20:25:21 -07:00
Igor Vaynberg
a3e188afe1 Merge pull request #1772 from KyKyPy3/master
Fix selection first element from "postprocessResults"
2013-10-08 20:21:47 -07:00
Yoni Jah
a65a3ce038 #1776 and #1722 dropdown position issue 2013-10-08 12:37:37 +03:00
Andrew Velis
204d4a276e Update to unselect method to support "select2-removing" triggers.
The goal here is send off a triggered event to a subscriber that an
element is going to be removed. It hasn't removed yet but would be
after the event fires. I have also added logic to determine if a
subscriber has prevented default. This will prove useful in the future
if a subscriber needs to extend the functionality for other usages.
2013-10-07 20:47:12 -07:00
Andrew Velis
f39ab3080e Fix for #1518. Update to select2.js to trigger properly named event.
By the documentation the event that should be fired is "select2-removed" however the event that actually gets fired is called "removed"
2013-10-06 21:27:40 -07:00
Efremenko Roman
9266d7cf55 Fix selection first element from "postprocessResults" - exclude selected elements from highlightable elements 2013-10-06 17:02:03 +04:00
Richard Huang
701e84ea21 append label only when formatted is not undefined 2013-09-19 11:19:10 +08:00
Corinna Schmidt
5bd41fc00c Compatibility with jQuery 1.10
removeAttr("disabled') is no longer correct with the most recent version
of jQuery. Should use prop("disabled", false) instead.
2013-09-17 16:01:45 -04:00
Igor Vaynberg
9e7dde66b7 Merge pull request #1722 from yonjah/master
dropdown repostion fix when previous postion changes container position
2013-09-17 07:22:48 -07:00
Alexander Zaytsev
67699746b4 Use more specific selector for finding options of a select 2013-09-16 21:54:29 +02:00
Yoni Jah
e6840fdc37 dropdown repostion fix when previous postion changes container position 2013-09-15 10:25:35 +03:00
Edwin Vlieg
ca9b55fadb Remove negative selector for .select2-selected
This broke scroll behaviour when displaying the selected items in the
dropdown.
2013-09-11 12:58:05 +02:00
cnanney
3b54482522 Fix focus on select
Focus should go back to select2-focusser, not select2-choice.
2013-09-06 18:57:41 -05:00
evangun
cfec9c6434 Edit the default initSelection function to pass all tag properties
The function will now pass all properties of the objects passed as tags to the constructor, not just the "id" and "text" properties. Because a tag is not always just an id and a text, just like when you provide the items with the "data" object instead.

This makes sure these properties are always available at the runtime of formatSelection() or formatResult(), which is not currently the case when the field is repopulated on a triggered "change" event.

My code looks like this :

$el.select2({
...,
tags: [{
  //id
  id: 1,
  //the string that will matched against the user's query
  text: 'martin smith greatmartin@provider.com'
  //the label of the item that will be shown if this tag is selected
  label: 'M. Smith',
}],
formatSelection: function(object, container){
  return object.label || object.text;
},
//right now I have to override the default function:
initSelection: function(){...}
});
2013-09-05 18:18:50 +02:00
jdecuyper
fa4ce8e382 Enable function formatResultCssClass. 2013-09-03 23:29:42 -05:00
Igor Vaynberg
fb8bf6d51d do not leak click events. fixes #1622 2013-09-03 21:16:16 -07:00
Igor Vaynberg
7d60f619ce Merge pull request #1211 from jhinch/pixel-rounding-problems
Search width inconsistencies in different browsers due to fractional pixels
2013-09-03 20:48:35 -07:00
jdecuyper
02dea18dc9 Avoid locked options to be selected and deleted. 2013-09-03 17:20:35 -05:00
jdecuyper
a380ebabd5 Remove duplicated options from multi-valued select boxes. 2013-08-30 18:16:41 -05:00
Duncan Smart
edc0d86fd2 Added select2-clearing event
that allows clearing selection to be canceled.
2013-08-30 21:35:01 +01:00
Igor Vaynberg
ca7550bf4d Revert "Fixed Tab key not respecting opts.selectOnBlur" breaks tab key. fixes #1646.
This reverts commit 6eb74930d5.
2013-08-30 08:55:16 -07:00
markwellna
3c2d7f7310 Clicking outside of dropdown removes select2-container-active class.
Closes #1661.
2013-08-28 13:05:41 -04:00
François Pluchino
9bc68f089e Fix the focus when list is closed on the mouse click event 2013-08-21 12:16:50 +02:00
Igor Vaynberg
c4529b8700 fix missing placeholder. closes #1614 2013-08-14 16:57:37 -07:00
Jonathan Forby
a4dc0ba522 Fix missing dropdownCssClass on init
Fixes issue #1615 where dropdownCssClass is no longer applied.
2013-08-14 16:54:10 -04:00
Igor Vaynberg
4dce07a431 fix usecase when a placeholder is not defined but an option with an empty value exists. fixes #1573 2013-08-12 08:43:13 -07:00
Chris Stasiak
2515e19ed9 Removed BOM 2013-08-12 12:22:48 +02:00
Igor Vaynberg
2400357d59 small fix for #1604 2013-08-09 16:38:23 -07:00
jdecuyper
e1b50a306b Add 'nextSearchTerm' function
- Given a previous selection 'nextSearchTerm' determines what the next search term should be.
- Remove some leftover tabs.
- Fix a typo: 'install the' instead of 'install sthe'.
2013-08-09 17:26:23 -05:00
Streid
e4c1e061e4 Tab to spaces 2013-08-09 11:33:41 +03:00
Streid
1d1212c5ed Fix: Not working adaptDropdownCssClass callback. 2013-08-09 11:30:47 +03:00
Igor Vaynberg
59df6b4c9a prevent scrolling when dropdown is opened. fixes #1540 2013-07-31 22:05:44 -07:00
Igor Vaynberg
e162a4802c tweak how mask is created to remove jitter. fixes #1574 2013-07-31 21:41:37 -07:00
Igor Vaynberg
2ab64be416 Merge pull request #1563 from UltCombo/1562
Fixes #1562 do not trigger change on $().select2('data') unless specified with the second param
2013-07-30 09:41:56 -07:00
Igor Vaynberg
28ea518257 width: copy option needs to ignore min-width and max-width. fixes #1557 2013-07-27 10:02:27 -07:00
Igor Vaynberg
852784dd3f fixes #1504 - undo changes made to labels during init 2013-07-26 23:58:38 -07:00
Igor Vaynberg
238903f5f4 close before destroying. fixes #1550 2013-07-26 22:22:21 -07:00
UltCombo
69396da14f data method use the same triggerChange logic as val method 2013-07-25 21:41:22 -03:00
Fede Isas
337fac620e add zepto compatibiliy 2013-07-25 16:44:41 -03:00
UltCombo
2d58f5b084 Fixes #1562; remove some dead code
No longer fire change event when .select2('data', falsyValue) is called without the 3rd param;
Dead code removed: !"" is true.
2013-07-23 18:55:09 -03:00
Ebbe Brandstrup
6eb74930d5 Fixed Tab key not respecting opts.selectOnBlur 2013-07-22 09:30:35 +02:00
Igor Vaynberg
92fe5018c9 fix 'autocaptilize' typo. fixes #1544 2013-07-18 14:05:47 -07:00
Igor Vaynberg
0c479b4cd1 additional tweal to #1528 to make formatters skip nulls 2013-07-17 00:32:41 -07:00
Igor Vaynberg
99dbc66d95 fix incorrect reference. fixes #1530 2013-07-15 23:10:19 -07:00
Igor Vaynberg
eaf2704a18 fixes #1528 Returning [] from data method on unset value for single-selects 2013-07-15 23:01:49 -07:00
UltCombo
a6c5302e71 fixes #1536 2013-07-15 11:59:34 -03:00
Igor Vaynberg
24716bc872 fixes #1513 2013-07-10 16:49:42 -07:00
Igor Vaynberg
1f09c7abaf fix options with empty values. fixes #1497 2013-07-09 00:14:48 -07:00
Alexander Ryden
3e2f11d193 Remove the byte order mark 2013-07-08 13:56:11 +02:00
Igor Vaynberg
b8c203ca36 fix #1478 2013-07-03 23:08:55 -07:00
Igor Vaynberg
cdcdc98b55 copy style attr from original element. fixes #1476 2013-07-03 22:42:44 -07:00
Igor Vaynberg
bed05df474 Merge pull request #1486 from fjmilens3/select2-loaded-events
Added select2-loaded event trigger in loadMoreIfNeeded
2013-07-03 22:20:12 -07:00
Igor Vaynberg
88af7ce387 add missing semis. fixes #1489 2013-07-03 22:17:05 -07:00
Igor Vaynberg
37073f623a Merge pull request #1485 from timisbusy/master
Trimming in opts.createSearchChoice
2013-07-03 15:27:58 -07:00
Igor Vaynberg
42d3ef4405 use click instead of mousedown so we dont break drag and drop support 2013-07-03 15:19:37 -07:00
Igor Vaynberg
ea14b7c30d Merge pull request #1474 from geophree/query-fix
Ignore old queries, remove highlight when beginning a new query.
2013-07-03 15:19:15 -07:00
Frederick John Milens III
37bf85ead0 Added select2-loaded event trigger in loadMoreIfNeeded 2013-07-02 10:38:09 -05:00
Tim Atkinson
a469143f01 adding trim to opts.createSearchChoice default function to avoid mismatches with val object 2013-07-02 10:35:12 -04:00
Jeff Hanke
2a0cc76236 Remove ajax out-of-order dropping code, handled in updateResults now. 2013-07-01 13:30:44 -07:00
Igor Vaynberg
be535c7a77 add support for diacritics. fixes #1472 2013-06-28 10:05:12 -07:00
Jeff Hanke
1eb461a42c Ignore old queries, remove highlight when beginning a new query. 2013-06-27 13:17:35 -07:00
Igor Vaynberg
76f9bae39a fix js error that happens when enter is pressed and there is no highlighted option. fixes #1469 2013-06-27 08:15:58 -07:00
Mateusz Dereniowski
8fb7f46297 Add accurate comment to the 'equal' function 2013-06-27 10:30:09 +02:00
Jeff Hanke
338a126067 Always call createSearchChoice and tokenizer with the Select2 object as this. 2013-06-26 14:20:22 -07:00
Cyrille Jouineau
7303852862 replaces a <div> inside a <a> with a <span>
and minor code cleaning
2013-06-26 16:32:07 +02:00
Igor Vaynberg
75edea83b2 added support for data-locked=true next to locked=locked attr. fixes #503. 2013-06-25 21:56:31 -07:00
Igor Vaynberg
4969dcb42c fix #1396 - fix destroy() when double initting 2013-06-23 15:21:16 -07:00
Igor Vaynberg
ef136731d4 move markup escaping of selection into the formatSelection callback. fixes #1417. fixes #1420 2013-06-23 14:32:45 -07:00
vitalets
c57dd1f0ff fix: data not passed in select2-loaded event 2013-06-22 18:19:44 +04:00
Igor Vaynberg
3ab1aafae5 fix #1425 ctrl+enter should not open 2013-06-19 22:49:35 -07:00
Igor Vaynberg
ce67f7b7fb fix #1426 - reinitting screws up tabindex 2013-06-19 22:39:03 -07:00
Igor Vaynberg
455067ed4e fix #1391 make tabbing out work when no results message is shown 2013-06-13 21:02:49 -07:00
Igor Vaynberg
c36b53ad24 fix #1404 allow formatnomatches to be null in multiselects 2013-06-13 20:48:48 -07:00
Igor Vaynberg
48294f2aea remove undermask for ie since its no longer needed after #1414 2013-06-13 20:34:59 -07:00
Igor Vaynberg
4aaa887b64 fix ie detection logic 2013-06-12 18:32:22 -07:00
Igor Vaynberg
7c729555e5 improve highlighting in single selects 2013-06-12 17:56:58 -07:00
Igor Vaynberg
29129008d5 when opened scroll to selected item. fixes #1408. closes #1411 2013-06-12 17:49:32 -07:00
Igor Vaynberg
b1867b5341 fix access to search method. fixes #1392 2013-06-06 21:58:10 -07:00
Igor Vaynberg
4917429c7a fixes #1387, better handling of ajax handler var 2013-06-05 08:23:49 -07:00
Mike S
bbd08bec03 Restoring allowedMethod container 2013-06-04 10:09:49 -07:00
Mike S
796c9e802a Renamed to search 2013-06-04 10:04:14 -07:00
Mike S
06130ffc12 Added setSearch method 2013-06-04 10:04:13 -07:00
Igor Vaynberg
30dac9a40b export default escapeMarkup function so it can be easily accessed. #1222 2013-06-04 08:42:46 -07:00
Igor Vaynberg
4e7a8b00fc a tweak to prevent clicks propagating through the mask on IE9. #1058 2013-06-04 08:33:02 -07:00
Igor Vaynberg
8904e42ef9 correctly handle undefined placeholders. tweak to issue #1365 2013-06-03 12:12:46 -07:00
Igor Vaynberg
def8adca7c cleaner way to detect older IE 2013-06-03 11:19:00 -07:00
Igor Vaynberg
5d8f03c90b clarify syntax. fixes #1358 2013-06-03 10:02:19 -07:00
Igor Vaynberg
d08d9ff18c Revert "add title for choice item"
This reverts commit 79228ce1e0.
2013-06-03 09:55:52 -07:00
Igor Vaynberg
a4a3eedd51 component stays open after clicking on a native select in IE. fixes #1356 2013-05-31 17:57:21 -07:00
Igor Vaynberg
efc609d073 close on tab-out. fixes #1341 2013-05-31 17:14:29 -07:00
Igor Vaynberg
cb7b5464a1 only validate initSelection is present on val() if we are not clearing 2013-05-31 15:29:14 -07:00
Igor Vaynberg
9a3666edb5 Merge pull request #1365 from corinnaerin/master
Feature: Allow placeholders with nonempty values
2013-05-31 15:12:32 -07:00
Jeff Turcotte
ae71175dbe Added ability to get the dropdown element 2013-05-31 12:17:15 -04:00
Corinna Schmidt
50cbd3927c new placeholderOption option
added ability to specify an option through a function or the shortcut
"first" which will be used as the placeholder option. If no placeholder
text is specified, then the text of this option will be used as the
placeholder text.
2013-05-30 13:41:08 -04:00
Igor Vaynberg
ae2f61ef12 Merge pull request #1351 from alexhaas/patch-1
Fixing inline width declaration when this.opts.width is set to "copy"
2013-05-28 13:15:54 -07:00
Igor Vaynberg
6858742e16 improve focus handling on mobiles. fixes #1344 2013-05-28 12:32:36 -07:00
alexhaas
0fc90ec95a Update select2.js
Fixing a container width problem that was caused by an inline width declaration when this.opts.width is set to "copy" (the default).
2013-05-27 15:13:09 -03:00
Igor Vaynberg
87e62004f6 remove unnecessary code 2013-05-22 23:40:26 -07:00
Igor Vaynberg
f1a5fe2c9e remove dupe format no matches messages. fixes #1341 2013-05-22 23:38:39 -07:00