Skip to content

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

Closed
@Pranava29

Description

@Pranava29

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
}
});
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions