Topic: MDBSelect & MDBSelectOption issue

musme free asked 4 years ago


1) MDBSelectOption cannot be rerendered with new "checked" prop. I did not succeed in putting code here, please follow the link - https://codesandbox.io/s/elegant-cdn-1p6l9

I did screencast for you as well - http://somup.com/cqjYiXeZpV

2) Label has wrong position if not wrapped in MDBRow and MDBCol , e.g. when using two MDBSelects in a row.Please follow the link showing this issue - https://prnt.sc/ouyqpn

3) Documentation has a mistake.Please follow the link showing this mistake - http://prntscr.com/ouyr07

I`m looking forward to hear from you!

P.S. I use 19.01 version


Aliaksandr Andrasiuk staff answered 4 years ago


Hi,

Thank you for the response!

1) We suggest to not use Uncontrolled Select. We spend more time working on Controlled version and probably will not support Uncontrolled version in the future.

I tried to reproduce the behaviour with Controlled version(but it's a little bit different) and it works well :

import React, { Component } from 'react';
import { MDBSelect, MDBBtn } from 'mdbreact';

class Select extends Component {
  state = {
    value: { code: 'default', name: 'Default' },
    options: [
      { text: 'Default', value: '1', checked: false },
      { text: 'Big', value: '2', checked: false },
      { text: 'Small', value: '3', checked: false }
    ]
  };

  reset = () => {
    const options = [...this.state.options];

    options.map(option => {
      if (option.text === 'Default') {
        option.checked = true;
      } else {
        option.checked = false;
      }
      return option;
    });

    this.setState({ options });
  };

  render() {
    const { options } = this.state;
    return (
      <div>
        <MDBSelect color='primary' label='Example label' options={options} />
        <MDBBtn onClick={this.reset}>Reset to Default</MDBBtn>
      </div>
    );
  }
}

export default Select;

2) Yes, it's a bug. But it does not happen with Contollrolled Select.

3) It will be fixed as soon as possible!

We will look for errors in Uncontrolled versions but I can't promise it will be soon.

Due to the fact that Uncontrolled version will lose support in the future, I recommend using Controlled version.

Hope I could help.

Best regards.



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: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.19.0
  • Device: PC
  • Browser: Chrome 75.0.3770.100
  • OS: Windows 7 64
  • Provided sample code: No
  • Provided link: Yes