1
0
mirror of synced 2024-11-25 22:36:03 +03:00
Commit Graph

328 Commits

Author SHA1 Message Date
Igor Vaynberg
ab1a8b93bf some code cleanup. fixes #269 2012-07-26 08:59:51 +03:00
Igor Vaynberg
00058ab315 fix markup escaping. fixes #268 2012-07-26 08:47:10 +03:00
Igor Vaynberg
bb51eb7120 double escape markup populated via html() and append(). fixes #269 2012-07-25 14:08:25 +03:00
Igor Vaynberg
3e42cae401 after triggering change also trigger click to help some validation frameworks. closes #259. closes #262. 2012-07-25 08:11:42 +03:00
Igor Vaynberg
b3089218dc fix tracking of results under mouse. fixes #258 2012-07-25 00:55:53 +03:00
Igor Vaynberg
e620b54271 improved tabbing and tabindex support as well as minor focus management tweaks. fixes things broken by #256 2012-07-24 17:07:14 +03:00
Igor Vaynberg
5d496bd470 Merge branch 'master' of github.com:ivaynberg/select2 2012-07-24 15:10:45 +03:00
Igor Vaynberg
f06aae38fb better handling of tags that are not just strings. fixes #256 2012-07-24 15:10:31 +03:00
Kevin Brown
c58cd12829 Reworks search field. Fixes #239
Uses the correct EOLs now, fixes iPad keyboard issue.
2012-07-23 12:04:50 -04:00
Igor Vaynberg
116528908a clean up val. now it only accepts ids and only when initselection is set 2012-07-21 14:27:49 +03:00
Dean Sofer
ad8fd257aa Added truth checks to avoid unnecessarily firing initSelection.
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-07-21 12:14:17 +03:00
Dean Sofer
d54fd4dd0e Passing a string to select2('val') with initSelection causes it to be used.
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-07-21 12:14:17 +03:00
Igor Vaynberg
b672d760ac allow a custom function for computing the width. fixes #252 2012-07-20 21:24:34 +03:00
Igor Vaynberg
3fc1bc6f35 focus select2 on a click to a related label. fixes #198 2012-07-20 21:15:11 +03:00
Igor Vaynberg
37ff4bbf36 added close event. fixes #246 2012-07-20 17:28:15 +03:00
Igor Vaynberg
33fd9dc810 another tweak for positioning of dropdown and scrollbars. fixes #228 again 2012-07-20 17:12:58 +03:00
Igor Vaynberg
0d5be21e09 fix bug with determing the width. fixes #242 2012-07-20 00:56:37 +03:00
Igor Vaynberg
a718dc45a0 fix multiselects in IEs. fixes #241 2012-07-20 00:53:03 +03:00
Igor Vaynberg
1771c3ba61 fix bug where space was ignored in single selects. fixes #233 2012-07-19 11:13:02 +03:00
Igor Vaynberg
1fc09825ed tweak dropdown position. fixes #228 2012-07-19 11:08:09 +03:00
Igor Vaynberg
96c0166535 more flexible width strategies. fixes #237 2012-07-19 10:55:46 +03:00
Kevin Miller
17ffe5772e container receives width style when hidden input has one or via opt
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-07-19 01:12:43 +03:00
Igor Vaynberg
6c330eb53b fixes IE8 bug where the dropdown wouldnt open. it would actually open and close immediately because the body would get a focusin event even after the focus was set on the search field by select2. worked fine in IE9 2012-07-19 01:06:16 +03:00
Igor Vaynberg
633a6dc901 mark elements as selected when closeOnSelect is false so they cannot be selected again. fixes #229 2012-07-18 10:26:49 +03:00
Igor Vaynberg
ad9fac45ae make sure data() returns null instead of undefined when unset. this will prevent chaining which may seem weid. fixes #230 2012-07-18 09:56:02 +03:00
Igor Vaynberg
de0d11a82b position the dropdown after hiding selected elements so when above it doesnt float away from the control 2012-07-18 00:51:17 +03:00
Igor Vaynberg
39aa17a790 fixed above/below dropdown opening bug 2012-07-18 00:26:49 +03:00
Igor Vaynberg
3a830a2b81 make the option element available to the matcher function when attached to select. can be used to match on option attributes as well as option text. fixes #227 2012-07-17 16:39:57 +03:00
Igor Vaynberg
b731545eea Merge pull request #223 from malekpour/master
fix dropdown reopen on enter
2012-07-17 04:54:43 -07:00
Igor Vaynberg
33e8e20159 optimize global mousemove listener 2012-07-17 12:38:09 +03:00
Igor Vaynberg
0aea42fe42 give the sizer a higher offset just in case its on a highres screen 2012-07-17 12:10:46 +03:00
Igor Vaynberg
7947803df4 delay finding the body until it is needed and cache it. 2012-07-17 12:01:22 +03:00
Ali Malrkpour
01faae3ff7 fix updateResults prevention if dropdown is closed 2012-07-16 16:30:53 -04:00
Igor Vaynberg
3ed2cc091a fixed dropdown alignment in firefox. still need to test IE. #214 2012-07-16 19:38:02 +03:00
Igor Vaynberg
69758f0b71 added a little animation for removed multiselect choices 2012-07-16 14:10:56 +03:00
Igor Vaynberg
0c4888c6ef expose plugin defaults to make configuration easier. fixes #199 2012-07-16 12:25:12 +03:00
Igor Vaynberg
c17336d1ac rename tagSeparator to separator. #191 2012-07-16 11:35:04 +03:00
Grzegorz Kaczan
5aae33d789 Add the ability to specify custom tags separator.
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-07-16 11:32:02 +03:00
Igor Vaynberg
4489ab7769 clean up some comments 2012-07-16 11:24:55 +03:00
Ali Malrkpour
a3383141d5 fix body element caching for non attached elements 2012-07-15 23:20:56 -04:00
Igor Vaynberg
d6f506e16b more flexible format helpers. fixes #217 2012-07-16 00:22:44 +03:00
Igor Vaynberg
1605a631e5 reworked how dropdown is managed in singleselect so the search field has focus even when the dropdown is not opened and can capture te first keypress. fixes #196 2012-07-15 22:22:38 +03:00
Igor Vaynberg
06ec20dec6 improve keyup-change detection 2012-07-15 00:42:54 +03:00
Igor Vaynberg
6f973d6e40 formatSelection() can now return html string, dom, or jquery object in both multi and single select. #188 2012-07-14 23:35:57 +03:00
Mitko Tschimev
1a4b523871 -add possibility to return a jQuery object with formatSelection -the close event of the selection is now delegated to the class 'select2-search-choice-close' and not only the a tag
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-07-14 23:22:08 +03:00
Igor Vaynberg
5a73385474 fixes #194 2012-07-14 09:23:21 +03:00
Igor Vaynberg
5859dc8149 possible fix for #205 2012-07-14 00:34:33 +03:00
Igor Vaynberg
4d79adf6ac make keyup-change event work with repeated backspace/delete keys. fixes #211. closes #212 2012-07-14 00:20:21 +03:00
Igor Vaynberg
482cc409ea dropdown can now open above or below control depending on available screens pace. fixes #120. based on #197 2012-07-11 12:33:38 +03:00
Igor Vaynberg
2c0344a520 take the outerwidth of the element when sizing so we include padding and border. fixes #213 2012-07-10 09:40:00 +03:00
Igor Vaynberg
0538bdcfa6 reposition the dropdown whenever results are changed. this is in preparation for open-on-top issue #197 2012-07-10 08:10:52 +03:00
Igor Vaynberg
48fe58dee3 better sizing of the input field in multiselect. fixes #203 2012-07-09 22:20:20 +03:00
Igor Vaynberg
a4d496281a fix input sizing when placeholder is set. fixes #192 2012-07-06 23:30:39 +03:00
Igor Vaynberg
77de06ecf3 improve percent width detection. issue #115 2012-07-06 12:13:12 +03:00
Igor Vaynberg
9c864f1da0 clear the ' ' placeholder on open 2012-07-05 11:24:36 +03:00
Igor Vaynberg
6a5719db80 added open event 2012-07-05 11:07:31 +03:00
Andy Fowler
ec08be78e4 jquery < 1.6 compatibility fix (:focus is unavailable) 2012-07-04 14:48:08 -04:00
Mitko Tschimev
ac8a4db76f bugfix moveHighlight: disabled list elements were highlighted now they are ignored
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-07-04 15:02:47 +03:00
Royce Feng
9baada2a5c Default to auto width if container has 0 width (hidden) 2012-07-03 10:03:21 -04:00
Igor Vaynberg
9c4a4d1b8a improve whitespace detection 2012-07-03 16:56:42 +03:00
Igor Vaynberg
83c11b27df fix firefox caret bug. closes #153 2012-06-29 22:38:34 -07:00
Igor Vaynberg
4ddcc52635 clear search field when data() is used. #178 2012-06-29 21:02:03 -07:00
Igor Vaynberg
95a144d85e highlighting and keyboard navigation improvements to result list that has optgroups 2012-06-29 20:15:45 -07:00
Igor Vaynberg
adc15e3682 fix page 2+ rendering. fixes #175 2012-06-29 05:20:06 -07:00
Igor Vaynberg
6b736669d2 add reference to original option element in the data when attached to select. fixes #171 2012-06-28 23:50:36 -07:00
Igor Vaynberg
504bca4b43 Merge branch 'master' of github.com:ivaynberg/select2 2012-06-28 23:44:42 -07:00
Igor Vaynberg
e12fbdec7e add data method that works with objects instead of ids like val. fixes #166 2012-06-28 23:44:30 -07:00
Igor Vaynberg
b886b40907 Merge pull request #173 from nutshellcrm/38b9d060b116fc4957110f25b03b8437be981136
Fix placeholders in jQuery 1.4
2012-06-28 21:49:45 -07:00
Igor Vaynberg
3107d9d773 manage the more element slightly more efficiently 2012-06-28 06:19:13 -07:00
Igor Vaynberg
593dadec54 trigger loadmoreifneeded on first and other pages 2012-06-28 05:34:26 -07:00
Igor Vaynberg
ea28fa4fe4 Revert "keep loading more results until there are enough to cause a scroll. closes #164 closes #164 closes #74"
This reverts commit ff03dbcaca.
2012-06-28 05:27:23 -07:00
Igor Vaynberg
ff03dbcaca keep loading more results until there are enough to cause a scroll. closes #164 closes #164 closes #74 2012-06-28 04:28:43 -07:00
Igor Vaynberg
89ee75dd9d do not open on meta key, closes #165 2012-06-28 02:27:09 -07:00
Igor Vaynberg
95b89d44f8 use opts.id func to check for id instead of hardcoded id key 2012-06-28 00:55:36 -07:00
Igor Vaynberg
45442aa8d7 removed trailing spaces 2012-06-27 21:44:31 -07:00
Alan Ho
e8083a6e3d Merge remote-tracking branch 'upstream/master' 2012-06-28 03:53:14 +08:00
Igor Vaynberg
7ec2dec955 change event now contains added/removed/val properties. fixes #133 2012-06-21 22:56:50 -07:00
Igor Vaynberg
050a23b53d small cleanup #148 2012-06-21 22:09:33 -07:00
Igor Vaynberg
88ab9f9348 define term and context. fixes #148 2012-06-21 22:08:56 -07:00
Igor Vaynberg
e85d131f0a add ability to programmatically specify css classes as well as css styles 2012-06-21 22:04:35 -07:00
Igor Vaynberg
54b83c2baf fix input field broken by fix to #132 2012-06-21 21:36:08 -07:00
Igor Vaynberg
16c3d31e06 full tabbing support for the mac. closes #132 2012-06-21 21:18:13 -07:00
Igor Vaynberg
e13dc41654 fix placeholder in multiselects when blurred by clicking outside 2012-06-21 19:19:19 -07:00
Igor Vaynberg
84f031f4b0 code navigation 'helpers' 2012-06-21 19:00:29 -07:00
Igor Vaynberg
4819d42f85 no longer need to blur in a settimeout because dropdown and searchfield are now detached. possibly fixes #132 2012-06-20 17:28:26 -07:00
Igor Vaynberg
8f6513969e when using default formatResult the matching substring is now wrapped in span with class select2-match. fixes issue #137 2012-06-19 21:31:56 -07:00
Igor Vaynberg
f9f3d6f4f3 add ability to pragmatically specify some css. fixes #121 2012-06-18 23:46:58 -07:00
Igor Vaynberg
8b566bf6ce fix hiding of search when minimumResultsForSearch are used. fixes #138 2012-06-18 23:34:54 -07:00
Igor Vaynberg
b7c952a1a3 ignore first empty option in selects when a placeholder is set 2012-06-18 23:16:45 -07:00
Igor Vaynberg
09f24fdda1 add new options.type parameter for ajax helper. fixes #139 2012-06-18 22:10:33 -07:00
Igor Vaynberg
af964bdbad shorten function name for loadingMore() 2012-06-18 20:48:52 -07:00
Aziz Gazanchiyan
663ba1215f Loading next page message formatting implemented, so it could also have localization
Signed-off-by: Igor Vaynberg <igor.vaynberg@github.com>
2012-06-18 20:46:51 -07:00
Igor Vaynberg
1e2881d5d1 a small optimization to how many times highlight is called 2012-06-18 20:44:26 -07:00
Igor Vaynberg
b2314bcb86 fix the fix for #129 2012-06-18 20:21:36 -07:00
Igor Vaynberg
9bf38c833c renamed opts.elementBody to this.body for brevity 2012-06-18 20:18:51 -07:00
Aziz Gazanchiyan
693b541361 Improve performance on dropdown detaching
Signed-off-by: Igor Vaynberg <igor.vaynberg@github.com>
2012-06-18 20:05:28 -07:00
Aziz Gazanchiyan
a0f067c2b2 Clear placeholder before opening dropdown, fixes #129
Signed-off-by: Igor Vaynberg <igor.vaynberg@github.com>
2012-06-18 19:57:08 -07:00
Aziz Gazanchiyan
7684371923 Improve resizeSearch() performance
Signed-off-by: Igor Vaynberg <igor.vaynberg@github.com>
2012-06-18 19:55:38 -07:00
Igor Vaynberg
b825d8ec41 restore smooth scrolling by fixing mouseevent-filtered 2012-06-17 00:45:44 -07:00
Igor Vaynberg
aba23fc3e7 Revert "remove unused code"
This reverts commit 93f5e7508f.
2012-06-17 00:28:18 -07:00
Igor Vaynberg
93f5e7508f remove unused code 2012-06-17 00:13:39 -07:00
creage
64b69425b0 Reduce search field focusing, improving performance
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-06-16 22:35:58 -07:00
creage
9497693b64 style detection for search field sizer corrected
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-06-16 22:35:58 -07:00
creage
492dccd1a5 no need for style if we already have a sizer
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-06-16 22:35:58 -07:00
creage
65eb7c3404 Improve performance on text measuring
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-06-16 22:35:58 -07:00
creage
0ff41ca512 Performance optimizations
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-06-16 22:35:57 -07:00
creage
68726643ac Save data values to correct context
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-06-16 22:35:57 -07:00
creage
151c3fd2f6 Stick mousemove event to element' context
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-06-16 22:35:57 -07:00
Igor Vaynberg
43d990c319 attach the dropdown to the element's body instead of the current body. issue #126 2012-06-15 08:29:47 -07:00
Igor Vaynberg
800b7bbb3f dont bubble up ESC keypress. fixes #118 2012-06-14 20:36:22 -07:00
Igor Vaynberg
1d0e9a4a5b a bit of jshint cleanup 2012-06-14 12:16:44 -07:00
Igor Vaynberg
16c868934d minor cosmetic cleanup 2012-06-14 09:39:23 -07:00
Igor Vaynberg
08d4485400 Merge pull request #107 from butsjoh/master
Fixed issue with loading array data and setting text key to a string
2012-06-14 09:37:33 -07:00
Igor Vaynberg
6e36003b0a Merge pull request #111 from chrisforbes/patch-1
Fix typo in comment
2012-06-14 09:36:12 -07:00
Pier-Olivier Thibault
5941fcea25 Using dropdownZIndex as opts. Dropping default value so use can set it via css. 2012-06-14 12:03:38 -04:00
Pier-Olivier Thibault
277ae4ff5a Added zindex options to dropdown so we can make sure it presents itself on top of whatever is existing in the DOM 2012-06-14 11:57:59 -04:00
Pier-Olivier Thibault
7d3ad2cd47 Merge branch 'master' of https://github.com/ivaynberg/select2 into zIndex 2012-06-14 11:56:55 -04:00
Igor Vaynberg
55fd00169e simplify optgroup querying and rendering code. provide a more powerful populateResults() function fixes #58. fixes #105. fixes #84 2012-06-14 00:21:22 -07:00
Andy Fowler
38b9d060b1 make getPlaceholder() compatible with jquery 1.4
(doesn't check data- attrs when using .data())
2012-06-13 18:06:41 -04:00
Chris Forbes
460cd059f9 Fix typo in comment 2012-06-14 09:06:37 +12:00
Johan Buts
cd538772df Fixed issue with defining the text property as string
because data gets reset afterwards also look at
failing example #e10_2
2012-06-13 13:09:43 +02:00
Igor Vaynberg
9fc18a9ca8 minor cleanup 2012-06-12 22:19:08 -07:00
Igor Vaynberg
0ccfd4853c rename updatePositions() to positionDropdown(). more clear 2012-06-12 22:19:08 -07:00
Igor Vaynberg
a6eeadbe7a always detach and append the dropdown on open. this ensures it will be the last element in body and thus have the highest z-index. issue #105. issue #84 2012-06-12 22:19:07 -07:00
Christopher Nadeau
6151ddbb0d Add support for hierarchies and unselectable items. issue #58
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-06-12 22:18:54 -07:00
Christopher Nadeau
efccc62510 Few tweaks to multi style
Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-06-12 22:18:53 -07:00
Christopher Nadeau
2f3262d39e Absolutely position dropdown. fixes #84.
Changes to detach dropdown and append to body, and absolutely position
dropdown. Fixes clipping problems with overflowing.

Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-06-12 22:18:40 -07:00
Igor Vaynberg
d62bc5bef1 various small fixes. closes #99 2012-06-12 19:41:21 -07:00
Alan Ho
0d29fff1dd Merge remote-tracking branch 'upstream/master' 2012-06-10 18:16:12 +08:00
Igor Vaynberg
3ba3e57715 issue #77, blur on touchend - seems more native 2012-06-07 23:56:51 -07:00
Igor Vaynberg
5e18e71cb4 possible fix for issue #77 better blur support for touch devices like ipad 2012-06-07 23:47:10 -07:00
Igor Vaynberg
47064b2483 tweak to issue #85 do not highlight items based on keypresses 2012-06-07 23:09:51 -07:00
Adam Solove
ec759ac809 When not showing search box, up/down arrows and searching still work.
- The hidden search box is displayed off-screen instead of taken off the dom.
- User can type a search, but instead of filtering the results, just highlight the first matching result.

Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-06-07 21:56:22 -07:00
Alan Ho
af1c398076 Make initSelection works asynchronously 2012-06-08 12:22:06 +08:00
Igor Vaynberg
4ba25b8095 ability to provide custom matchers. closes #86 2012-06-07 20:47:33 -07:00
Igor Vaynberg
6fe77c6110 disabled mode support wip, issue #76 2012-06-06 22:34:51 -07:00
Igor Vaynberg
c27880c19c Merge branch 'master' of git://github.com/ivaynberg/select2 2012-06-04 17:15:25 -07:00
Igor Vaynberg
c44ea24aa4 renamed roundtripValue to context. closes #72 closes #73 2012-06-04 17:15:11 -07:00
Alexander Pepper
0d98ea03af Adds an additional parameter roundtripValue to function data.
Enables a stored value, which can be passed by the function 'result' to the next call of the function 'data'.

This is a solution for issue #72

Example:

    data: function (term, page, roundtripValue) {
      var options = {
        q: term,
        limit: 5,
      };
      if (typeof(roundtripValue) !== 'undefined' && roundtripValue != null) {
        options['continuation_handle'] = roundtripValue;
      }
      return options;
    },
    results: function (data, page) {
      var roundtripValue = data.continuation_handle;
      var more = typeof(roundtripValue) !== 'undefined';
      return {results: data.results, more: more, roundtripValue: roundtripValue};
    },

Signed-off-by: Igor Vaynberg <igor.vaynberg@gmail.com>
2012-06-04 16:46:23 -07:00
Igor Vaynberg
26da9f0b2e Merge pull request #71 from niquola/master
fix indexOf with undefined
2012-05-29 17:06:57 -07:00
Igor Vaynberg
f368464132 add drag and drop sort support, fixes #60 2012-05-29 17:04:52 -07:00
nicola
23720246f2 fix internal function indexOf, when undefined passed 2012-05-29 19:15:20 +04:00
Igor Vaynberg
1633d71b4a add container() method that retrieves the main container 2012-05-28 23:15:41 -07:00
Igor Vaynberg
cb7f1da4e6 Merge branch 'master' of git://github.com/ivaynberg/select2 2012-05-28 15:16:23 -07:00
Igor Vaynberg
9ecce5af7c support numeric text keys in local data. fixes #68 2012-05-28 15:15:58 -07:00
Igor Vaynberg
071d6c73d2 Merge pull request #63 from ericbarnes/tags-tab
Adding tab support for tags
2012-05-23 08:13:07 -07:00
Geoffrey Hing
6dcb276485 Check for nonexistent data attribute in a way that works in jQuery 1.4.2 2012-05-22 11:40:42 -05:00
Eric Barnes
66b789939f Adding tab support for tags
When you select a tag currently the only way to select it was by using the enter key. This change allows the tab key to also select it.

Signed-off-by: Eric Barnes <eric@ericlbarnes.com>
2012-05-22 09:30:10 -04:00
Igor Vaynberg
058ecae750 fixes #61 2012-05-18 14:50:35 -07:00
Igor Vaynberg
af6031039a build script 2012-05-16 10:36:28 -07:00