Topic: Display previously selected value in Material Select in React

rashesh patel free asked 5 years ago


Hi,

I am facing problems while using MDB React Material Select.

For example:

1) In my project I have set 2 option in Material select (Active & Inactive) as you can find in below imageTable-00 2) I have saved that value in the table, as you can find in below image Table-01 3) While I have to edit particular row then by selecting checkbox and selecting edit option You can find the same value which was selected at the time of adding which is set as default value, as you can find in below image

Table-02

Table-03

4) By selecting and Save other option (Active to Inactive) it shows in table, as you can find in below image

Table-04

Table-05 5) While next time I am selecting same row and going for edit then in that Material select option in shows 'Active' instead of 'Inactive' which I had selected and saved previously, as you can find in below image

Table-06

Table-07

6) So What should I have to do to Set the option which is selected previously in the material select??


rashesh patel free answered 5 years ago


Image- code of select component

Material Select


Aliaksandr Andrasiuk staff commented 5 years ago

Hi,

Please show me the code of your Select component. It will be better if you also will attach code of your app, so I could find the problem.

Best regards.


rashesh patel free commented 5 years ago

Hi Aliaksandr,

My one .js file code is of 1000 lines...So is there any other option where I can show you the code, Like by Email...


Aliaksandr Andrasiuk staff commented 5 years ago

Hi,

Maybe you have a repository with that project?

You can add it to the github for example. But, don't forget to delete your key in package.json file.

So I could look through the whole project and it will increase chances to find an error.


Aliaksandr Andrasiuk staff answered 5 years ago


Hi,

Check if in your Select component there is no property selected in SelectOption component with active value by default.

Can you show me the code snippet of your Select component?

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.11.1
  • Device: LAPTOP
  • Browser: CHROME
  • OS: WINDOWS 10
  • Provided sample code: No
  • Provided link: No