ComboBox?

Ungr pro asked 6 years ago

I cannot find ComboBox/Search form element. Is there no support for it in MDB yet?


Arkadiusz Idzikowski staff answered 6 years ago

Please take a look at our select with searchbox example (you need to swtich tab to 'examples & customization at the top of the page).

https://mdbootstrap.com/docs/angular/forms/select/#e-search-box


Ungr pro answered 6 years ago

  1. When I click on 'Search here' inside select then it closes instantly.

  2. There seems no option to add custom values which is what ComboBox by default is

I simply need an input:

  • That searches in data source
  • Is able to select multiple values
  • Supports custom written values that will be added to (internal/JS) data source

Arkadiusz Idzikowski staff answered 6 years ago

There is a temporary problem with search box in the documentation, the component will work correctly in your application.

We don't have a combo box component, but I think that all this features are available in our multiselect with filter. Please try this code:

HTML:

<div class="row">
  <div class="col-md-6">
    <mdb-select [multiple]="true" [filterEnabled]="true" [options]="optionsSelect" placeholder="Choose your option"></mdb-select>
  </div>
</div>

TS:

import {Component, OnInit} from '@angular/core';

@Component({
  selector: 'search-box-select',
  templateUrl: './search-box-select.component.html',
  styleUrls: ['./search-box-select.component.scss']
})
export class SearchBoxSelectComponent implements OnInit {
  optionsSelect: Array<any>;
  ngOnInit() {
  this.optionsSelect = [
    { value: '1', label: 'Option 1' },
    { value: '2', label: 'Option 2' },
    { value: '3', label: 'Option 3' },
    ];
  }
}

Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 7.4.3
  • Device: PC
  • Browser: Chrome
  • OS: Win
  • Provided sample code: No
  • Provided link: No