MDBSelect Creating Issue


Topic: MDBSelect Creating Issue

Nitin.Chanana asked 6 years ago

      <MDBSelect getValue={(value)=>this.handleChange("EventType",value)} options={this.state.eventtype} selected="Select Format"/>

This is my code getValue and getTextContent attribute is not working please provide any solution regarding this.. Thanks


Anna Morawska staff answered 6 years ago

Hi there,

I've just tested it in newly created CRA project and everything works fine. Please make sure you have the latest version of our package ( 4.9.0 ) and try this code:

import React, { Component } from "react";
import { MDBSelect } from "mdbreact";

class TextareaPage extends Component {
  state={
    per: [{
          checked: true,
          disabled: false,
          icon: null,
          text: "Per Team",
          value: "1"
        },
        {
          checked: false,
          disabled: false,
          icon: null,
          text: "Per Player",
          value: "2"
        },
        {
          checked: false,
          disabled: false,
          icon: null,
          text: "Per 2 Person Team",
          value: "3",
          id: "id"
        }],
      }

      handleChange = (text, value) => {
           console.log(text, value)
      }

      getValueOfSelect = value => {
        console.log(value)
      }

  render() {
    return (
          <>
            <MDBSelect getValue={(value) => this.handleChange("PerTeam", value)}         getTextContent={this.getValueOfSelect} options={this.state.per} selected="Select Fee         Per"/>
          </>
    );
  }
}

export default TextareaPage;

Let us know if it works for you.

Best,

Ania


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: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.8.4
  • Device: Lenovo Desktop
  • Browser: Google Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No
Related topics