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

825 Commits

Author SHA1 Message Date
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
Igor Vaynberg
213d281ece fix first char being lost. fixes #196 2013-05-22 22:14:42 -07:00
Igor G.
dae97ffc83 Remove duplication of "No matches found" message
In case if data is fetched in chunks, not at once, "No matches found" message is shown as many times as we requested for it.
Lets say we have 15 items, and data is fetched 5 at a time. After all items are selected, "No matches found" message would be duplicated 3 times.
2013-05-21 17:20:24 +03:00
Igor Vaynberg
70f1b29882 optimize mousemove listener. fixes #1328 2013-05-17 08:14:09 -07:00
James Ramsay
856dc0b526 Added support for css class for selected elements 2013-05-17 09:11:58 +10:00
Igor Vaynberg
06440a6bf8 MultiSelect JavaScript error - no method 'showSearch'. fixes #1311 2013-05-14 15:17:24 -07:00
Igor Vaynberg
de6d90c079 fix typo. fixes #1310 2013-05-14 14:05:33 -07:00
Julen Ruiz Aizpuru
66e06acde8 Removed BOM. 2013-05-14 11:41:31 +02:00
dirkpostma
f235a84aa8 Turn off autocorrect and autocapitilze
On e.g. mobile devices, it's more user friendly to turn off autocorrect in input fields. This patch adds the attributes autocorrect, autocapitilize and spellcheck. See also:

http://davidwalsh.name/disable-autocorrect
2013-05-12 21:06:16 +03:00
Igor Vaynberg
4e1873fb9d set maxlength on search when maximumInputLength is defined. closes #538 2013-05-10 00:43:30 -07:00
Igor Vaynberg
7fc16ed094 fix focus in mobile. fixes #1018 2013-05-09 09:48:31 -07:00
Igor Vaynberg
11c08cab12 bind/delegate -> on. #1260 2013-05-09 00:07:35 -07:00
Igor Vaynberg
92617ec54e preserve order of elements in the data call. fixes #1280 2013-05-08 23:53:30 -07:00
Foxel
a957ed81fd Fixed undefined this.autofocus on destroy while creating on element that already have select2 applied 2013-05-09 10:36:46 +07:00
Igor Vaynberg
5762b85dd2 prevent opening of a disabled select via api. fixes #1272 2013-05-07 12:39:18 -07:00
Igor Vaynberg
92ceb93e93 fix ajax defaults not to interfere with options 2013-05-07 09:07:03 -07:00
Igor Vaynberg
bcfa3fc702 show search if minimum input length has been set 2013-05-07 08:39:16 -07:00
Igor Vaynberg
43e6b86f75 prevent scrollback left on opening. fixes #467 2013-05-06 23:40:31 -07:00
Igor Vaynberg
13c1dcbf67 add default ajax options. fixes #1125 2013-05-06 21:20:08 -07:00
Igor Vaynberg
694432d83d fix fast typing in IE. fixes #949 2013-05-06 20:54:26 -07:00
Igor Vaynberg
26f41602b2 Merge pull request #1247 from juliankrispel/master
Display formatNoMatches when all ajax results are selected
2013-05-06 20:29:25 -07:00
Igor Vaynberg
e21018147c fixes #1263 2013-05-06 20:26:30 -07:00
Igor Vaynberg
d668ae76d0 select2-focus and select2-blur events. fixes #798. closes #866 2013-05-06 20:13:05 -07:00
Igor Vaynberg
882e7996f4 keep focus in control when the mask is clicked 2013-05-06 20:05:15 -07:00
Igor Vaynberg
4094c1c7de fix tab-on-select transfers focus to next element. fixes #898. fixes #1045 2013-05-06 19:42:38 -07:00
Igor Vaynberg
9c1caa6d3a add handling of autofocus attribute. fixes #837 2013-05-06 19:25:09 -07:00
Igor Vaynberg
b0959000b3 namespace events and consoldate select and selected into selecting. fixes #497. fixes #1262 2013-05-06 16:12:38 -07:00
Igor Vaynberg
266861ac51 fix parameter names 2013-05-06 15:26:46 -07:00
Igor Vaynberg
231cce0add Merge pull request #1187 from barryhunter/patch-2
Bugfix for Resetting Scrollpoint on Multi-select
2013-05-06 15:25:55 -07:00
Igor Vaynberg
8008bfa8dc attr to prop change. #1260 2013-05-06 15:23:46 -07:00
Igor Vaynberg
0fe95eb07c Merge pull request #1062 from bigmihail/patch-1
Use $.prop() to get "multiple" attribute
2013-05-06 14:07:26 -07:00
Igor Vaynberg
adb126edc6 Merge pull request #1239 from NielsKuhnel/master
Keyboard navigation in choices (whitespace preserved)
2013-05-06 13:41:06 -07:00
Igor Vaynberg
55827b9159 introduce support for separate readonly and disabled modes. closes #1253. fixes #778. closes #1183 2013-05-06 13:13:02 -07:00
Igor Vaynberg
62e0ae6004 #1260 closes #1252 fixes #992 - retrieve option text as value when value is not defined 2013-05-06 09:54:17 -07:00
Igor Vaynberg
83050fd2fa Problem escaped caracter on IE7. fixes #856 2013-05-06 09:34:44 -07:00
Julian Krispel-Samsel
9d06fe24dc Render formatNoMatches when all ajax results are selected #381 2013-05-04 08:03:00 +01:00
Niels Kühnel
870b1b7165 Less aggresive keyboard deletes and carret stays 2013-05-03 11:51:41 +02:00
Niels Kühnel
877c1d90c5 Keyboard navigation in choices (tags) 2013-05-03 00:41:55 +02:00
Leigh Halliday
da7dd51294 Changing to from &apos; to &#39; because &apos; isn't supported in IE8 2013-05-02 12:03:20 -04:00
Igor Vaynberg
78139a80ba work around chrome and mutation observer bug. fixes #1099 2013-04-27 11:08:29 -07:00
Vitaly
79228ce1e0 add title for choice item 2013-04-26 18:22:23 +04:00
Jason Hinch
f37f07006c Floor the searchWidth calculation due to inconsistencies between fractional pixel handling in different browsers 2013-04-24 15:04:38 +10:00
barryhunter
4e8da110d6 Bugfix for Resetting Scrollpoint on Multi-select
Duplicating pull request #974 - which seemed to only fix it for 'single' version. Have copied the same condition into the one for 'multi' case. There may be a better way, but in my testing this seems to have worked.
2013-04-15 00:25:51 +02:00
barryhunter
f511d5a2ff Allow overriding jquery's automatic cache-busting on ajax calls
By default jQuery (and Select2) add parameters to ajax calls, to invalidate browser caching. In certain circumstances its useful to disable this (eg when server sets good Cache-Control headers), this patch allows passing the cache/jsonpCallback params though to jquery's ajax function.
2013-04-14 23:14:16 +02:00
Julen Ruiz Aizpuru
8cb3698820 Fix #1172 -- Properly set width when allowClear is being used.
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2013-04-12 07:58:31 -07:00
Igor Vaynberg
25549c787b Revert "applied fix for #1172 - Clear button overlaps text"
This reverts commit fd07c11484.
2013-04-12 07:58:13 -07:00
Igor Vaynberg
06c82f2d0b do not propagate change event from the search field out of the component. fixes #1178 2013-04-11 20:22:52 -07:00
Alex Rice
a0f35aba3f Remove inline styles 2013-04-12 02:57:03 +00:00
Igor Vaynberg
4a0851bce5 Array data with custom key (string) isn't returning matches. fixes #1179 2013-04-11 19:15:16 -07:00
Igor Vaynberg
fd07c11484 applied fix for #1172 - Clear button overlaps text 2013-04-11 15:00:17 -07:00
Martin K.
9057a9606f Update select2.js
See #1175 - fixed typo introduced in last commit
2013-04-10 19:33:23 -03:00
Igor Vaynberg
45995d0f34 fix tabindex for both multi and single. fixes #1169 2013-04-10 12:56:30 -07:00
leipie
bc2c780449 Fix tabindexing
Actually set tabindex on the select2-focusser for focussing on tab
navigation

Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2013-04-10 12:43:30 -07:00
Igor Vaynberg
f582d8ae15 Merge pull request #979 from mynameistechno/master
Fixes #291
2013-04-10 12:30:05 -07:00
Igor Vaynberg
92e2c6d56f Merge pull request #1073 from norlin/master
Fix initSelection method with empty input value
2013-04-10 08:22:10 -07:00
Igor Vaynberg
dc27a5b74d add a rejectable select event. fixes #1053 2013-04-09 19:53:11 -07:00
Igor Vaynberg
2bf5a763c5 fix keystroke dropping when single select is opened by typing in unopened state really fast. fixes #949 2013-04-09 18:58:30 -07:00
Igor Vaynberg
bd2a8c6d84 centralize option tag to data element translation 2013-04-09 15:11:39 -07:00
Igor Vaynberg
49e9908656 Merge pull request #1162 from leipie/master
Fix IE8 clickable issues
2013-04-09 09:54:49 -07:00
Igor Vaynberg
598773258e fixes #1163 fixes #1160 fixes #1129 2013-04-09 09:51:24 -07:00
leipie
d1c81dfbe2 Make select whole select clickable in IE8 2013-04-09 17:12:01 +02:00
Igor Vaynberg
511c1b8728 when resolving width use case insensitive expression. fixes #1065 2013-04-08 16:25:46 -07:00
Igor Vaynberg
de07ba2b16 apply offscreen class after calculating width because offscreen class resets the width. also use css('width') when copying width if it returns a usable value. fixes #1140. fixes #1079 2013-04-08 16:24:15 -07:00
Igor Vaynberg
d80ec81199 Merge pull request #1055 from jessefoster/autoDropdownWidth
Add option to automatically size dropdown width
2013-04-03 09:16:01 -07:00
Dmitrii Chekaliuk
aedcc10b8f Fix focus issue on multi-value select
Inside the multi-value select box, when you hit backspace next to the
choice, it gets the `select2-search-choice-focus` class, but that class
is not being removed when select box loses the focus.
2013-03-28 02:29:59 +02:00
Igor Vaynberg
2f69290e2d Merge pull request #1095 from nolamesa/patch-1
Fix for random scrolling when using hierarchical data
2013-03-26 12:19:35 -07:00
Igor Vaynberg
f9f76d8b4c remove debug statement 2013-03-26 08:48:54 -07:00
nolamesa
5b0bbfeb7c Fix for random scrolling when using hierarchical data
When using hierarchical data there is a random scroll jump when hovering over select options. The reason is that in the case of hierarchical data the highlightable choices are <ul> and thus their outer height is many pixels (includes the children's height as well). A fix is to make the height calculations by using the the label divs.
2013-03-26 14:49:02 +02:00
Igor Vaynberg
7a3d3dcd2b Revert "Added ajax.transport support to default options"
This reverts commit 04a6535bd5.
2013-03-25 09:17:19 -07:00
Igor Vaynberg
94c1706c67 clear off active class when closing. #1089 2013-03-25 08:57:35 -07:00
Igor Vaynberg
519070b11d fix label focussing bug on ios. fixes #1008. 2013-03-25 08:54:01 -07:00
Igor Vaynberg
45559654bc fixes #1057 2013-03-25 08:54:01 -07:00
Igor Vaynberg
a624417556 Merge pull request #1083 from rvignacio/default_ajax.transport
Added ajax.transport default option
2013-03-23 21:22:34 -07:00
rvignacio
04a6535bd5 Added ajax.transport support to default options 2013-03-23 17:26:37 -03:00
gboer
ea39b25bf6 Update select2.js
Fix for when you specify tags using JSON-encoded select2-tags-attribute.

And thank you for properly implementing my (earlier) submitted hack :)
2013-03-23 15:05:16 +01:00
norlin
c8cae0a6c9 fix initSelection with empty input value 2013-03-22 10:14:39 +04:00
Mihail
381f173e55 Use $.prop() to get "multiple" attribute
The string 
opts.element.attr("multiple") 
returns:
1) string "multiple" - if element have attribute multiple (<select name="..." multiple></select>)
2) undefined - if element have not attribute multiple (<select name="..."></select>)
It is written in the documentation:
"As of jQuery 1.6, the .attr() method returns undefined for attributes that have not been set."
"To retrieve and change DOM properties, use the .prop() method."
(http://api.jquery.com/attr/)

I am propose use "prop" function. The string
opts.element.prop("multiple")
returns:
1) boolean "true" - if element have attribute multiple
2) boolean "false" - if element have not attribute multiple

After, the "multiple" variable use in check of the condition:
select2 = multiple ? new MultiSelect2() : new SingleSelect2();
Better use true/false variable value than "multiple"/undefined in this condition.

Tested in Opera 12 and IE 8.0.7601
2013-03-20 14:19:05 +02:00
ZhongYou
6a58e99285 trigger "focus" event in focus function make chrome error:
"Uncaught RangeError: Maximum call stack size exceeded"
2013-03-19 18:01:12 +08:00
jfoster
7956d7aee3 Add option to automatically size dropdown width 2013-03-18 19:56:38 -04:00
Igor Vaynberg
9acfc6faa5 prevent duplicate queries 2013-03-14 12:47:46 -07:00
Igor Vaynberg
3be8547584 added new loaded event. fixes #930 2013-03-14 12:00:06 -07:00
Igor Vaynberg
86a8190080 Loading icon doesn't disappear when using tags with auto tokenization. fixes #1005 2013-03-14 11:39:45 -07:00
Igor Vaynberg
b973b56cce Calling select2('open') on multiple select shows 'No Matches Found'. 2013-03-14 11:31:11 -07:00
Igor Vaynberg
911a0bb082 prevent form from being submitted when enter is pressed in multiselect. fixes #961 2013-03-14 11:14:37 -07:00
Igor Vaynberg
dd34cc5d67 always show spinner during searching. fixes #950 fixes #943 2013-03-14 10:00:25 -07:00
Jens Rantil
5193dc40b9 Fixing grammar
I find it hard to "type" less characters. It's sort of unintuitive.
2013-03-13 17:38:34 +01:00
frntz
78312ce33f Slash doesn't escaped
Caused problems during uglify minification
2013-03-13 08:40:47 +01:00
Igor Vaynberg
ae4b24a7e8 workaround for IE when manipulating classes. fixes #937 fixes #1017 2013-03-12 09:27:11 -07:00
sjschukin
1cff8d4d22 Update select2.js
bugfix: .select2("data", null) for remote datasource causes an error "ReferenceError: e is not defined"
2013-03-12 16:35:14 +04:00
Igor Vaynberg
814e8b5bed fix #1000 2013-03-07 16:04:19 -08:00
Stephen Starkey
e7f2aeaf08 Don't update results if maximumSelectionSize is 0
a maximumSelectionSize of zero means unlimited, which means 
we shouldn't be updating results if it's set to 0
2013-03-05 10:31:28 -06:00
Mark Matyas
8d424b3202 Fixes #291 2013-03-05 02:19:28 -08:00
Nils Kenneweg
414c376a1a fixed a bug resetting scroll when loading more data. 2013-03-04 13:54:03 +01:00
Dave Smith
953b6f2ac1 Fix mask height/width when document is shorter than window
When the document element (e.g., the body) is shorter than the window,
the select2-drop-mask was not extending all the way to the bottom
of the browser viewport, leading to an area below the body that was
clickable but that select2 did not notice. Thus, if a user clicked
down there, the drop would not disappear. This is particularly
troublesome if the page contains absolutely positioned elements at
the bottom of the browser window.
2013-03-01 15:05:46 -07:00
Igor Vaynberg
66860b2811 Merge pull request #964 from adam-iris/master
Fix for issue #934
2013-03-01 10:47:40 -08:00
Igor Vaynberg
debbcfcede correctly filter out selected options out of elements loaded by infinite scroll. fixes #881 2013-03-01 09:11:45 -08:00
Igor Vaynberg
5ae70eca5f work around a firefox bug when calculation search width. fixes #944 2013-03-01 08:29:40 -08:00
Igor Vaynberg
31101764ff add missing element prop to data. fix #936 2013-03-01 00:54:11 -08:00
Igor Vaynberg
8520793f25 workaround for chrome focus bug. fixes #939 2013-02-28 19:47:19 -08:00
Adam
dacf51361d Default local initSelection returns the actual selected items
Fix for issue #934. The default initSelection uses a matcher to find
items that match the selection, but if the data is hierarchical what
the matcher returns may actually be grouping elements, so they can't be
treated as a list of matching items.  This fix runs the matcher but
rather than using its return value it collects the matching item(s)
into a closure-scoped variable and then returns that.
2013-02-27 17:05:19 -08:00
Igor Vaynberg
83d77cfa62 fix search field focussing problems. fixes #922 2013-02-27 08:53:44 -08:00
Vincent Petry
08b75a1798 Do not trigger event when calling clear() from val() with empty value 2013-02-21 10:53:16 +01:00
Igor Vaynberg
cd0adbe913 fix duplicate values in IE. fix #840 2013-02-20 19:06:05 -08:00
Igor Vaynberg
8e9e65f864 Error when clearing a single-select box multiple times. fix #908 2013-02-20 18:36:11 -08:00
Igor Vaynberg
250447b53a Clicking the clear button raised the changed event twice. fixes #867 2013-02-20 08:51:03 -08:00
Igor Vaynberg
38758d754b fix ajax url() context. fixes #895 2013-02-19 14:11:38 -08:00
Igor Vaynberg
70be25cc6d fix ajax url() context. fixes #895 2013-02-19 13:21:57 -08:00
Igor Vaynberg
9bf4614cd5 fix ajax url() context. fixes #895 2013-02-19 11:54:38 -08:00
Igor Vaynberg
6b65976e17 Merge pull request #893 from bgertonson/ajax_url
#608 fix to allow distinct ajax urls
2013-02-19 10:03:28 -08:00
Bryan Gertonson
302c87b197 Because a shared options object is passed around when creating each instance of a select2 widget, the query function that was built would use the last ajax url that was set on the options object for all select2 widgets. By using a variable scoped to the closure, the ajax url can be maintained per select2 instance. 2013-02-19 11:18:54 -06:00
Vitaly
dea7979f11 TypeError: Cannot call method 'positionDropdown' of undefined 2013-02-19 12:19:27 +04:00
Lee Baker
6278e7cca0 Fixing when the data helper is a function for the local query
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2013-02-16 18:33:27 -08:00
Igor Vaynberg
7d908da52f allow data helper to be a function 2013-02-14 19:52:43 -08:00
Igor Vaynberg
76cd145380 fix placeholder sizing. fixes #430 2013-02-14 01:05:28 -08:00
Igor Vaynberg
179ba17174 do not take over mouseup event in dropdown. fixes #857 2013-02-14 00:49:45 -08:00
Igor Vaynberg
c081d0f00c fix placeholder problem. fixes #853 2013-02-13 01:15:05 -08:00
Igor Vaynberg
cd3d7421c4 allow hiding search field permanently. #189 2013-02-12 00:11:24 -08:00
Igor Vaynberg
8868d59176 delay creation of mask until opening. 2013-02-11 22:16:30 -08:00
Kevin Brown
940d1f2d67 Better imitate native touch experience 2013-02-11 20:31:18 -05:00
Igor Vaynberg
9035dfcb93 equal and indexof need to support comparing items of differnet types, ie string vs number. this is needed because numeric ids stored in val() are strings and need to be compared against data ids which are numbers. fixes #840 2013-02-10 15:16:38 -08:00
Igor Vaynberg
b3a0c3269a ignore modifier keys when enter is pressed. fixes #836 2013-02-09 23:55:34 -08:00
Igor Vaynberg
acdbb02498 open multi dropdown on paste. fixes #577 2013-02-09 23:24:09 -08:00
Igor Vaynberg
be76cd9ded Merge pull request #599 from DataDog/master
Update context from callback data on `query` call
2013-02-09 23:05:12 -08:00
Igor Vaynberg
bd1dfbd49d Revert "* Fix of issue 550 Select2 and CSS Transforms: dropdown menu is off position: https://github.com/ivaynberg/select2/issues/550"
This reverts commit ef8c49f85f.
2013-02-09 22:19:59 -08:00
Igor Vaynberg
cf2b696fd9 fire change on clear. fixes #558 2013-02-09 20:39:33 -08:00
Igor Vaynberg
f15583a555 make query() aware of the element select2 is attached to. fixes #561 2013-02-09 20:22:21 -08:00
Bob Burton
ef8c49f85f * Fix of issue 550 Select2 and CSS Transforms: dropdown menu is off position: https://github.com/ivaynberg/select2/issues/550
jquery offset() returns incorrect value when ancestor container has css transform applied to it, causing dropdown to appear in incorrect position.

Using { top: variable.offsetTop, left: variable.offsetLeft } instead of variable.offset() fixes this issue

Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2013-02-09 19:55:04 -08:00
Igor Vaynberg
6c9aef4bb3 fire selected before close. #835 2013-02-09 19:13:26 -08:00
Igor Vaynberg
a4c76f2dfb added selected and removed events. fixes #835 2013-02-09 16:44:44 -08:00
Igor Vaynberg
d54378563c fix closeOnSelect and maximumSelectionSize combo bug. fixes #672 2013-02-09 15:48:20 -08:00
Igor Vaynberg
6c4b96791d another tweak for css class filtering. #834 2013-02-09 15:14:45 -08:00
Igor Vaynberg
150160f183 sync css classes. fixes #834 2013-02-09 14:29:48 -08:00
Igor Vaynberg
ebc436c42b improve val() handling on multiselect. fixes #654 2013-02-09 09:41:35 -08:00
Igor Vaynberg
2f53c251d4 added params ajax option to pass extra params to transport. fixes #492 2013-02-09 01:20:19 -08:00
Igor Vaynberg
d56f43092b introduce highlight event. fixes #529. fixes #762 2013-02-09 00:45:14 -08:00
Igor Vaynberg
65af98cfed improve dropdown open up/down mode. fixes #589 2013-02-09 00:08:38 -08:00
Igor Vaynberg
640e7066d9 remove the val(' ').val('') work around in firefox as it is no longer needed. fixes #832 2013-02-08 21:53:43 -08:00
Igor Vaynberg
90998d8442 fire open event after the drop has been opened 2013-02-08 12:21:06 -08:00
Igor Vaynberg
d04d127cab fix triggering of unwated change. #824 2013-02-08 09:49:44 -08:00
Igor Vaynberg
0a201b07a5 Fixed 'width' and 'containerCss' incompatibility. fixes #828 2013-02-08 09:40:47 -08:00
Igor Vaynberg
69d4e0896d Fixed 'width' and 'containerCss' incompatibility. fixes #828 2013-02-08 09:34:09 -08:00
Igor Vaynberg
ef364d2118 better handling of first character typed. fixes #196 2013-02-08 09:33:18 -08:00
Igor Vaynberg
3be3188853 fix bug in destroy method that would keep the original element hidden. fixes #815 2013-02-07 16:20:29 -08:00
Igor Vaynberg
3ec535ec5b make search work with chinese/japanese imes. fixes #814 2013-02-07 16:17:44 -08:00
Igor Vaynberg
275e094dff fix infinite recursion on focus. fixes #816 2013-02-07 16:16:26 -08:00
Stanislav Lesnikov
946a1c6329 Add missing semicolons 2013-02-08 00:46:29 +01:00
Igor Vaynberg
270d4bad07 default initSelection in tags mode instead of overriding it. fixes #811 2013-02-06 15:26:19 -08:00
Igor Vaynberg
d1e9531a0a use a form of attr that will always set the value. fixes #810 2013-02-06 14:02:15 -08:00
Igor Vaynberg
4ba14bbf01 disable ajax caching, fixes #807 2013-02-05 21:28:33 -08:00
Igor Vaynberg
b55efddf07 pass escape markup into formatResult 2013-02-05 17:25:32 -08:00
Igor Vaynberg
e78dc69a6b call escape markup on results 2013-02-05 15:16:21 -08:00
Igor Vaynberg
c90bfc3e22 Merge pull request #702 from skivvies/master
allow passing a function for maximumSelectionSize
2013-02-05 15:05:57 -08:00
Igor Vaynberg
81a0e2610a improve placeholder management. fixes #712 2013-02-05 15:02:43 -08:00
Igor Vaynberg
df2aaa0cfc disable focus-via-tab when disabled. fixes #614 2013-02-05 14:50:06 -08:00
Igor Vaynberg
8332d6a7e9 fix more hierarchical selection bugs. fixes #775 2013-02-01 15:21:07 -08:00
Igor Vaynberg
ecbdc9305b minor optimization. #787 2013-02-01 12:27:30 -08:00
Igor Vaynberg
5374b8799b sync disabled and readonly statuses off original element even post creation 2013-02-01 12:21:28 -08:00
Igor Vaynberg
22dba24881 fix selectOnBlur when closed by means other then tab key. fixes #470 2013-02-01 11:09:08 -08:00
Igor Vaynberg
a19e33e3af ignore configured placeholder on selects without first empty option. fixes #785 2013-02-01 10:46:40 -08:00
Igor Vaynberg
76295bb5e9 use the dropdown mask to close open flyouts instead of a global listener. also move the original element off screen instead of hiding it so clicking a label focuses select2 instance 2013-01-31 23:58:42 -08:00
Igor Vaynberg
c66a91a9bb allow '0' vals to be set. fixes #646 2013-01-31 17:10:30 -08:00
Igor Vaynberg
32249cc7f0 better support orientation change on mobile. #782 2013-01-31 16:45:43 -08:00
Igor Vaynberg
300e99fcd5 Merge pull request #756 from socialceramics/url-function-with-arguments
Ajax `url` option (when function) now called with same arguments and context as `data` option
2013-01-31 14:31:32 -08:00
Igor Vaynberg
4482c2af85 by default do not trigger change from val. #771 #619 2013-01-31 14:25:51 -08:00
Igor Vaynberg
273ec1438e Merge pull request #771 from phtrivier/issue-619
#619 : val takes an optional argument to avoid triggering 'change'
2013-01-31 14:24:45 -08:00
Igor Vaynberg
3f87728f7f fix highlighting bugs introduced by disabled option support. fixes #765 closes #775 2013-01-31 13:15:46 -08:00
Igor Vaynberg
7a006a7259 fix scroll event handling since it doesnt bubble. also add a shim behind the dropdown, this allows it to properly close even when used inside modals. sometimes modals will place their own shim that closes the modal and aborts the default mousedown event. in such cases the modal would close but the dropdown element would still float on the screen now detached and the only way to close it would be to make a selection 2013-01-31 10:52:18 -08:00
Igor Vaynberg
3f14f773f9 dont error out when 'x' is removed really fast multiple times. fixes #745 2013-01-30 22:39:03 -08:00
Igor Vaynberg
db39cdf584 remove dead code. fixes #772 2013-01-30 22:29:19 -08:00
Igor Vaynberg
ee01ab79ad fixes #770 2013-01-30 22:23:18 -08:00
Igor Vaynberg
c270d3e4a3 do not close the dropdown on resize or scroll, instead keep it positioned. fixes #753 #669 #719 2013-01-30 21:49:57 -08:00
phtrivier
cf095d9fee #619 : val takes an optional argument to avoid triggering 'change' 2013-01-30 10:21:40 +01:00
Barry Coughlan
89d583736a Fix issue introduced by 20950e0f0c.
Selected items and other invisible items were not ignored by highlightUnderEvent when calculating index.
This caused highlighting of incorrect items when the list contained hidden items.
2013-01-29 18:45:33 +00:00
Jason Purcell
56631aa09f adding defensive check for existence of select2 on the target element during the document mousedown/touchend events 2013-01-28 15:01:17 -05:00
Jason Purcell
67af5a43f1 ajax url function is now passed same arguments and called with same context as data option 2013-01-25 12:40:17 -05:00
Igor Vaynberg
434827d22c Merge pull request #747 from Kollibri/master
Fix issue with disabled options (Issue #733)
2013-01-24 08:42:06 -08:00
Igor Vaynberg
acc6f7923e optimize string comparisons. fixes #743 2013-01-24 08:31:43 -08:00
Amanda Myer
1c183ef23b Update select2.js 2013-01-24 11:09:30 -05:00
Amanda Myer
20950e0f0c Update select2.js
Fixed issues with select2 and disabled options, most of it having to do with incorrectly determining the index of an option when disabled options were being displayed.
2013-01-24 08:59:09 -05:00
Arnar Birgisson
f49b1006aa Use tags correctly when set as a function. 2013-01-23 22:25:34 +01:00
Ronald J Kimball
7ec1e753dc Avoid error when label has no matching element
$('#no_such_element').data("select2") returns null rather than
undefined (jQuery 1.9.0).
2013-01-23 13:53:15 -05:00
Igor Vaynberg
4e92c8b1b4 allow ajax.data to be undefined. fixes #732 2013-01-23 09:24:23 -08:00
Igor Vaynberg
7d8409393c fix parenthesis mismatches 2013-01-23 08:57:10 -08:00
Cristhian Valencia B.
81cfaa587a Update select2.js
missing parenthesis at line :1448 & :1845
2013-01-23 11:14:12 -05:00
Schlogen
567cb7dbe7 Fix for jQuery 1.9 2013-01-22 17:00:38 -05:00
Igor Vaynberg
e89a851727 Merge pull request #715 from vitalets/default-initselection-hidden
Default initSelection() for hidden element
2013-01-16 11:40:26 -08:00
vitalets
88a86e5953 add default initselection for single and multi 2013-01-16 22:35:24 +04:00
vitalets
3570ab523e add third param to matcher in local 2013-01-16 22:09:31 +04:00
vitalets
f63a10ccb1 ready for single 2013-01-16 21:29:17 +04:00
Igor Vaynberg
fa908972b4 Merge pull request #610 from MaxxSoftware/master
Firefox Tab and Enter keys issue.
2013-01-16 08:45:11 -08:00
Igor Vaynberg
fcea1523fd Merge pull request #703 from jelte12345/master
Fixed my own XSS pull request to actually work
2013-01-14 09:52:40 -08:00
_pants
7bdad56837 allow passing a function for maximumSelectionSize 2013-01-12 11:37:57 -05:00
Jelte Fennema
c0dd741a79 Fixed testing mistake 2013-01-12 17:29:48 +01:00
Igor Vaynberg
353672832d Merge pull request #691 from jelte12345/master
Fix XSS injection
2013-01-11 16:39:48 -08:00
Le Wang
a1273b639a add loadMorePadding option
- Trigger load before scrolling to the very bottom.
- When scrolling very fast, unless we pre-load entries, the page itself
  will scroll.
2013-01-10 17:02:00 +08:00
Frédéric Camblor
a770ade670 Allow to pass a callback as ajax.url 2013-01-08 18:54:14 +01:00
Igor Vaynberg
b4f6462bb2 Merge pull request #643 from akinnee/master
Added an option: select highlighted option on blur, "selectOnBlur: false"
2013-01-08 09:02:23 -08:00
Jelte Fennema
a65c08097e Make the escapeMarkup function escape html tags and some other characters and apply it to usefull places 2013-01-08 11:35:58 +01:00
Igor Vaynberg
8e9a231847 add [option disabled='disabled'] support. fixes #480 fixes #157 2013-01-04 09:16:48 -08:00
Igor Vaynberg
7a797300a5 Merge pull request #652 from tispratik/master
Be able to limit each input to a maximum length
2012-12-27 20:56:14 -08:00
Igor Vaynberg
df5a03f0b6 Merge pull request #594 from omab/master
Results sorting on populateResults function
2012-12-27 08:37:54 -08:00
Pratik Khadloya
007fd8c3f5 Be able to limit each input to a maximum length 2012-12-14 13:49:01 -08:00
Grzegorz Klimek
0d6ba97144 Update select2.js
jQuery("input#someId").attr("tabIndex") don't work well in new jQuery 1.8+.
When you try this on field  that don't have tabIndex attr you get undefined 
(but document.getElementById("someId").tabIndex returns '0').
This is why Select2 element onBlur stay whit attr tabindex='-1' 
and you can't navigate form with 'tab' key.
This simple ' || 0' fix this bug.
2012-12-13 10:39:34 +01:00
Alex Kinnee
fa6313afa4 Added the option to select highlighted upon blur, false by default. Original functionality is maintained by default. 2012-12-12 13:54:47 -05:00
tom
b33c86e5e4 Fixes >1 multi-select dropdown being open at the same time
Bug was reproduced on latest FF/Chrome/Safari, but IE exibits correct
behavior with or without the fix.

See: http://jsfiddle.net/tmD7c/2/
2012-12-10 12:46:27 -05:00
Chris Rueber
86952b4ed9 Update select2.js
Adding case to fix placeholder not being displayed when element not visible.
2012-12-08 11:36:07 -06:00
Julien Muetton
09d29585a0 Triggers change when value is set programaticaly.
``` js
$('#select').select2().
    on('change', function () {
        alert('change');
    }).
    val(['foo']);
```

Now shows an alert window.
2012-12-03 09:59:15 +01:00
MaxxSoftware
327e00b0ba Firefox Tab and Enter keys issue.
When item is selected by enter, the list is reopened.
Also pressing tab on focused element with drop list cause immediate reopening with empty search result list.
2012-11-28 12:45:14 +06:00
Conor Branagan
57638ab392 update this.context with data context on query calls 2012-11-21 15:51:31 -05:00
Matías Aguirre
53eaf1fbe1 Results sorting option. Refs #95 2012-11-21 14:12:01 -02:00
Igor Vaynberg
2eb28a60aa allow override of createSearchChoice in tags. fixes #567 2012-11-15 09:56:05 -08:00
MaxxSoftware
ac7de2a756 Update select2.js 2012-11-15 17:26:19 +06:00
MaxxSoftware
1560a3918a Update select2.js
DropDown displayed on the left of select-container if not fit right.
2012-11-15 17:16:55 +06:00
Igor Vaynberg
aa686aa47e Merge pull request #541 from brendanheywood/master
Fixed bug with closeOnSelecet is false
2012-11-02 08:57:15 -07:00
Brendan Heywood
6c59b1e99c Only select the first suitable item if nothing is already selected 2012-11-01 18:00:38 +10:00
Brendan Heywood
291f595a03 Fixed scrolling bug when closeOnSelect is false 2012-10-31 16:35:34 +10:00
tom
ca98ce5564 trivial change: pluralize formatInputTooShort function 2012-10-24 23:48:00 -04:00
Igor Vaynberg
4a363c4b30 Merge pull request #503 from todd-givainc/master
Feature: Locked Items
2012-10-24 13:48:46 -07:00
Kevin Warrington
77ea616d0c fix issue #517 2012-10-22 17:00:03 -06:00
Todd Rafferty
1d4ea633aa Goofed, changed disabled to locked. 2012-10-16 14:41:03 -03:00
Todd Rafferty
43939f08a4 Create locked items that can't be removed.
This patch creates multi select items that can't be removed.
2012-10-16 14:33:35 -03:00
Igor Vaynberg
3ed91862fa fixed dropdown positioning when select2 has margins. fixes #501 2012-10-16 10:22:25 -07:00
Igor Vaynberg
c4e00c6926 Merge pull request #485 from lisandropuzzolo/patch-1
Update select2.js
2012-10-10 13:35:15 -07:00
Kevin Brown
f5ac9bf90c Fixed anchor hrefs
Fixes #482: Mobile Safari issues
2012-10-10 17:24:58 -03:00
lisandropuzzolo
da414577e8 Update select2.js
Fixed line 2154 to allow Select2 work with multiple levels hireachal data.
2012-10-10 12:07:53 -03:00
Igor Vaynberg
26a3d5342b update license in js header 2012-10-03 11:30:12 -07:00
Igor Vaynberg
732ad030a0 fix tab index issues. fixes #408 2012-10-02 10:09:31 -07:00
Kevin Brown
c4c1cbabde Fixed placeholder detection. Fixes #424. 2012-09-24 18:35:13 -03:00
Igor Vaynberg
98976946d6 pass element attr to initSelection for selects upon init 2012-09-24 09:22:36 -07:00
Igor Vaynberg
fccc84cd11 relax formatSearching check. #434 2012-09-21 08:19:31 -07:00
Jacob Haslehurst
3fcfbed03a formatSearching can be disabled
formatSearching can be disabled by returning null from the function which allows the searching message to be disabled.
2012-09-21 16:12:27 +10:00
brettmas
c577158599 original option not available to formatSelection on init
The original option isn't available to formatSelection when initializing the selection from a select[multiple]
2012-09-21 02:39:58 +10:00
Igor Vaynberg
2027c0cebf trigger blur handlers on source element when select2 is blurred 2012-09-19 19:37:58 -07:00
Igor Vaynberg
93ed30d67a mange disabled attr on source element. fixes #427 2012-09-19 19:33:46 -07:00
Igor Vaynberg
a145378848 postprocess results always if closeOnSelect is false. fixes #348 2012-09-18 08:42:23 -07:00
Igor Vaynberg
f18caa5957 jquery 1.8.x fixes. fixes #388 2012-09-17 19:52:42 -07:00
Igor Vaynberg
2cb435680b fixes #366 2012-09-17 19:34:50 -07:00
Igor Vaynberg
bdd746844d tweak formatSelection for #400 2012-09-17 19:25:21 -07:00
Igor Vaynberg
f7e78f6ed9 label for support for id's with brackets, eg id='name[first]'. fixes #422 2012-09-17 18:43:26 -07:00
Igor Vaynberg
4b1204c5de improve keyboard handling. fixes #389 2012-09-13 16:38:20 -07:00
Igor Vaynberg
908c3583d7 bind abbr handler before mousedown. fixes #386 2012-09-13 14:42:53 -07:00
Igor Vaynberg
ab7ab5b3f7 allow clearing on backspace as well as delete. fixes #396 2012-09-13 00:09:17 -07:00
Igor Vaynberg
6690cc449c fix clearing when using jquery 1.6. fixes #386 2012-09-12 16:20:52 -07:00
Jean Boussier
7bc63dd264 Get rid of 2 useless jQuery.delegate event handler 2012-09-12 14:57:35 -04:00
Jean Boussier
3387853d9c Keep a cached reference to jQueryfied document 2012-09-12 14:50:17 -04:00
Jean Boussier
720bdb8c4f Store last mouse position in a variable instead of document datastore
It's hundred times faster. See http://jsperf.com/data-vs-variable
2012-09-12 14:47:25 -04:00
Igor Vaynberg
96657a16aa fix for dropdown closing as soon as its opened in IE8. fixes #369. fixes #354 2012-09-10 17:05:11 -07:00
Igor Vaynberg
b4371aa253 remove executable permission from files 2012-09-10 10:40:44 -07:00
Kevin Chung
7be0e509ff Remove references to jQuery.Events, replace with the closure dollar variable. 2012-09-09 19:35:34 -07:00
Kevin Chung
770924ca8d Fix empty Select2 input from throwing an error when attempting to selecting a value. 2012-09-09 19:06:14 -07:00
Mark DiMarco
7c2dba8fe0 safer check for result.children
`("children" in result) && result.children.length` fails if children is explicitly null.
2012-09-06 16:55:04 -05:00
Igor Vaynberg
281f314fd7 fix performance issue in firefox. fixes #382 2012-09-06 09:17:24 -07:00
Igor Vaynberg
cb44a86649 Merge pull request #374 from tzarger/master
Fix for ValidationEngine & hiding errors on change.
2012-09-05 10:33:05 -07:00
Brent Burgoyne
5580dbbc4c Fixed drop down alignment issue when body has an offset and is not position static 2012-09-05 11:14:12 -06:00
Igor Vaynberg
e5a2824fae Merge pull request #377 from pmirshad/master
Tabbing out doesn't put placeholder back on input tags with multiple=true and no value selected
2012-09-04 17:25:45 -07:00
Gavin Wahl
1b2765fced Pluralize 'items' in formatSelectionTooBig 2012-09-04 16:23:52 -06:00
pmirshad
9fe2453079 Adding event argument to the bound function 2012-09-05 01:52:55 +05:30
pmirshad
5cf5deb267 Fix placeholder missing on tab out on input tags
Tabbing out of input tags with multiple set as true and no value
selected will result in the default placeholder not being shown.
This patch fixes the issue by calling clearSearch() on blur of
MultiSelect2 and preventing the bubbling of the blur event to the
abstract class.

Test case with version 3.2: http://jsfiddle.net/pmirshad/PqP2L/1/
2012-09-05 01:50:34 +05:30
Troy Zarger
039f6b5de9 Fix for ValidationEngine &hiding errors on change.
Copying class attribute to container causes and issue with the JQuery
ValidationEngine. In order to prevent double validation checking, a
simple replace call to copy all but the actual validation[] class.

Also, added a blurOnChange default setting, to allow people to trigger
and blur() event in case of using JQuery ValidationEngine  in order to
immediately hide the validation error message when selecting an option.
2012-09-04 00:43:25 -04:00
Igor Vaynberg
222fa7e415 fix data helper when used with compound choices without a text attribute. fixes #370 2012-08-31 13:41:56 -07:00
Igor Vaynberg
7baa3b9e93 make escapeMarkup configurable. closes #355 2012-08-27 09:48:02 -07:00
Sławek Ehlert
55cc11f9b7 forgot to remove log
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-08-27 09:27:07 -07:00
Sławek Ehlert
852a515d04 make escapeMarkup optional
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-08-27 09:27:07 -07:00