This repository was archived by the owner on Oct 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix(#271) if option is set the refresh function is getting the request. #1845
Merged
Merged
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
84420c3
fix(#271) if option is set only on activate the refresh function is g…
Jefiozie d137ded
Instead of new var used the open variable as it is set on activate.
Jefiozie 57f612a
Changed so that attr is removed and watch is checkin select.open
Jefiozie 91e48dd
Reverted: removed broadcast event
Jefiozie 2a8509f
changed watch of search as the initial value should be ignored on load
Jefiozie a52f0b2
reverted the watch function for the desired use cases.
Jefiozie d7a5df2
Added test for initial refresh call
Jefiozie 98c179a
removed some whitespace
Jefiozie 7531d29
Revert "Added test for initial refresh call"
Jefiozie 119b072
removed empty line
Jefiozie 914f2d8
Merge branch 'master' into 625_refreshOnActive
Jefiozie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,10 +55,9 @@ uis.directive('uiSelectChoices', | |
|
||
|
||
$select.parseRepeatAttr(attrs.repeat, groupByExp, groupFilterExp); //Result ready at $select.parserResult | ||
|
||
$select.refreshOnActive = scope.$eval(attrs.refreshOnActive); | ||
$select.disableChoiceExpression = attrs.uiDisableChoice; | ||
$select.onHighlightCallback = attrs.onHighlight; | ||
|
||
$select.dropdownPosition = attrs.position ? attrs.position.toLowerCase() : uiSelectConfig.dropdownPosition; | ||
|
||
scope.$on('$destroy', function() { | ||
|
@@ -68,7 +67,7 @@ uis.directive('uiSelectChoices', | |
scope.$watch('$select.search', function(newValue) { | ||
if(newValue && !$select.open && $select.multiple) $select.activate(false, true); | ||
$select.activeIndex = $select.tagging.isActivated ? -1 : 0; | ||
if (!attrs.minimumInputLength || $select.search.length >= attrs.minimumInputLength) { | ||
if ((!attrs.minimumInputLength || $select.search.length >= attrs.minimumInputLength) && (!$select.refreshOnActive || ($select.refreshOnActive && $select.open))) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can undo changes here also. It will be up to user to check in their own function. |
||
$select.refresh(attrs.refresh); | ||
} else { | ||
$select.items = []; | ||
|
@@ -80,10 +79,14 @@ uis.directive('uiSelectChoices', | |
var refreshDelay = scope.$eval(attrs.refreshDelay); | ||
$select.refreshDelay = refreshDelay !== undefined ? refreshDelay : uiSelectConfig.refreshDelay; | ||
}); | ||
|
||
scope.$watch('$select.open', function(open) { | ||
if (open) { | ||
tElement.attr('role', 'listbox'); | ||
if(!angular.isUndefined($select.refreshOnActive)){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder instead if we do this in a |
||
//only add a watch when refreshonactive is set. | ||
$select.refresh(attrs.refresh); | ||
} | ||
} else { | ||
tElement.removeAttr('role'); | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets remove the attribute, this can be default functionality. We just call refresh more often now. (ie. When
search.length == 0
)