Topic: Select - API - reinitialise select

smachesney free asked 3 years ago


Hi

I have a table which include select options. When I clone a row I can't reinitialize the select option with a new ID and the same value.

I've tried:

  1. cloning, changing ID & setting value :

    const selectMeetingMinuteOwner = document.getElementById(`meetingMinuteOwner-${lastId}`); 
    let meetingMinuteOwnerSelect = new mdb.Select(selectMeetingMinuteOwner)
    
  2. cloning, changing ID, disposing & reinitialize with new mdb.Select():

    const selectMeetingMinuteOwner = document.getElementById(`meetingMinuteOwner-${lastId}`);
    let meetingMinuteOwnerSelect = new mdb.Select(selectMeetingMinuteOwner) 
    meetingMinuteOwnerSelect.dispose(); 
    meetingMinuteOwnerSelect.setValue((`ownerId-${clonedMeeting.ownerId}`));
    

However I can't seem to do it.

Also, on your table editable plugin, are date pickers supported?

ThanksSonia


smachesney free commented 3 years ago

As an FYI I don't just want the select element's options cloned, I also want the selected value of the target select to be the selected option on the cloned select


Grzegorz Bujański staff commented 3 years ago

Please add the complete code - HTML containing the table with select, JS code that copies the row and initializes the select. etc. I'll check why it doesn't work.

I understand that you also have a problem with the date picker? Immediately add the code that relates to this problem and let us know what is not working


smachesney free commented 3 years ago

Hi Grzegorz

I figured out what was wrong, when I cloned the entire table for, the select wrapper was also cloned, I needed to remove this before re-initializing.

I haven't written the date picker question yet, my question it, can I use datepicker component in the table editor plugin?


Grzegorz Bujański staff commented 3 years ago

There should be no major problems with that. Theoretically, we created this plugin with the intention of presenting the data in the form of a table, but not with the intention of inserting other components inside. But it should be possible to do so.



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Opened

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: 3.2.0
  • Device: desktop
  • Browser: Chrome
  • OS: windows
  • Provided sample code: No
  • Provided link: No