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

i want to show all selected names in dropdown itself how can i do that? #301

Open
sagarss1911 opened this issue Sep 13, 2021 · 1 comment

Comments

@sagarss1911
Copy link

So for now if 1 item selected then it shows it name and then it shows 2 options selected or 3 options selected. i want to change it and show all selected names is there any config params available or how can i do it?

@majid99h
Copy link

you can do to extend this file

import { Injectable } from '@angular/core';
import { TreeviewItem, TreeviewSelection, DefaultTreeviewI18n } from 'ngx-treeview';

@Injectable()
export class DropdownTreeviewSelectI18n extends DefaultTreeviewI18n {
  private internalSelectedItem: TreeviewItem;

  set selectedItem(value: TreeviewItem) {
    this.internalSelectedItem = value;
  }

  get selectedItem(): TreeviewItem {
    return this.internalSelectedItem;
  }

  getText(selection: TreeviewSelection): string {
    return this.internalSelectedItem ? this.internalSelectedItem.text : 'Please select';
  }
}

and add this class at component like this

providers: [
    { provide: DefaultTreeviewI18n , useClass: DropdownTreeviewSelectI18n }
    ]

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