Topic: MDBAutoselect defaultValue not working

shariffelkordy premium asked 2 years ago


Expected behavior The defaultValue to be what I specified

Actual behavior default value is blank Resources (screenshots, code snippets etc.) const data = ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight']; return ( { return data.filter((item) => { return item.toLowerCase().startsWith(value.toLowerCase()); }); }} /> );


Krzysztof Wilk staff commented 2 years ago

Hi!

Could you provide a code for your issue? It's hard to recognize the problem without that.


shariffelkordy premium answered 2 years ago


const test_data = ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'hello world']

                  <MDBAutocomplete
                                    label='Example label'
                                    defaultValue='hello world'
                                    dataFilter={(value: any) => {
                                        return test_data.filter((item) => {
                                            return item.toLowerCase().startsWith(value.toLowerCase());
                                        });
                                    }}
                                />

Wojciech Staniszewski staff commented 2 years ago

It will be fixed in the next release. Thanks for reporting!



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

  • ForumUser: Premium
  • Premium support: Yes
  • Technology: MDB React
  • MDB Version: MDB5 5.0.0
  • Device: PC
  • Browser: Chrome
  • OS: Windows 11
  • Provided sample code: No
  • Provided link: No