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

selectedValueRender not working #204

Open
patriciadaianaboia opened this issue Oct 12, 2022 · 4 comments
Open

selectedValueRender not working #204

patriciadaianaboia opened this issue Oct 12, 2022 · 4 comments

Comments

@patriciadaianaboia
Copy link

I have tried to use it but it's not working. Can you please give some examples?

Thanks

@gmerabishvili
Copy link
Owner

@patriciadaianaboia Check more clear description here: #161

@patriciadaianaboia
Copy link
Author

I would like to see how to implement it, not just a description. Also are you sure it is working? Has it been tested?

We are not able to use it. We want to remove html tags once a value is selected.

@elliotSMK
Copy link

I'm also facing this issue - I'm finding that the selectedValueRender function is being called when the component is initially rendered but not when an item is selected.

The template form code I'm using is this:

<ng-autocomplete
        #ngAutoComplete
        [data]="organisationSuggestions"
        name="organisationAutoSuggest"
        [debounceTime]="200"
        [minQueryLength]="3"
        [required]="true"
        (inputChanged)="onChangeSearch($event)"
        [(ngModel)]="model.organisationId"
        [initialValue]=""
        [placeholder]="placeholder"
        [searchKeyword]="keyword"
        notFoundText="Not found"
        [itemTemplate]="itemTemplate"
        [notFoundTemplate]="notFoundTemplate"
        [selectedValueRender]="selectedValueRender"
      >
      </ng-autocomplete>

My render function is this:

public selectedValueRender: any = (item: any) =>
    item === null ? '' : item.parentName === null ? item.name : item.name + ' - ' + item.parentName;

My keyword and placeholder are set here:

public placeholder: string = 'Enter an organisation name';
public keyword: string = 'name';

Any insights why this isn't triggering the render function would be appreciated, thanks!

@filipvercauteren
Copy link

I am facing the same problem. SelectedValueRenderer is not called. Any suggestions ?

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

4 participants