Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: mdb-auto-completer component displayValue - get selected value

Jared Bratu pro asked 5 years ago


I'm trying to use the displayValue input of the MdbAutoCompleterComponent by adding [displayValue]="onDisplayValue" to my template. The onDisplayValue function is triggering and I'm able to set a value, i.e.

onDisplayValue () { return 'some display value'; }

This will cause 'some display value' to appear in the field.

The problem is I can't determine what value was selected for the onDisplayValue function to alter it. The displayValue function seems to trigger before the data-bound element is set or the select/selected outputs are emitted.

How can I get the value of what was selected or entered in the mdb-auto-completer function using the displayValue input?


Bartosz Termena staff answered 5 years ago


Dear @Jared Bratu

Thank you for the response, we will take a closer look on our documentation, and we'll make the necessary corrections.

Best Regards, Bartosz.


Jared Bratu pro answered 5 years ago


I found the answer. The displayValue function has one parameter which is the value selected. If I change my onDisplayValue function to:

onDisplayValue (v) { 
  return 'now displaying ' + v; 
}

Everything works as expected. The documentation about displayValue wasn't clear.


FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Closed

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 8.3.1
  • Device: Desktop
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No