Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function assigned to on-search-change attribute doesn't get triggered when the labelFilter length changes from 1 to 0 #479

Closed
Pranava29 opened this issue Sep 27, 2016 · 1 comment

Comments

@Pranava29
Copy link

Pranava29 commented Sep 27, 2016

This is causing so many issues in our code as the search change calls few other functions and in the above case it does not.

Fix:
change the $scope.inputLabel.labelFilter.length > vMinSearchLength comparison to $scope.inputLabel.labelFilter.length >= vMinSearchLength

// Callback: on filter change
if ( $scope.inputLabel.labelFilter.length > vMinSearchLength ) {
var filterObj = [];
angular.forEach( $scope.filteredModel, function( value, key ) {
if ( typeof value !== 'undefined' ) {
if ( typeof value[ attrs.groupProperty ] === 'undefined' ) {
var tempObj = angular.copy( value );
var index = filterObj.push( tempObj );
delete filterObj[ index - 1 ][ $scope.indexProperty ];
delete filterObj[ index - 1 ][ $scope.spacingProperty ];
}
}
});
$scope.onSearchChange({
data:
{
keyword: $scope.inputLabel.labelFilter,
result: filterObj
}
});
}

@Pranava29
Copy link
Author

I have forked the branch and committed my changes
https://github.com/Pranava29/angular-multi-select

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants