0

I have created custom modules with Magento 2.2.6 and there is dynamic rows added in custom module UI component form. Admin can add/delete dynamic row in new form. but admin can not delete dynamic rows in edit form

Is there any way to do this ? please suggest

1

1.Dataprovider.php(controller)

<----- Your code------>
  if($id){
     $this->loadedData[$questions->getId()]['do_we_hide_it'] = true;
   }else{
      $this->loadedData[$questions->getId()]['do_we_hide_it'] = false;
   }

<----- Your code------>

2.ui_form.xml

<------ Your code -------->
 <actionDelete>
    <argument name="data" xsi:type="array">
       <item name="config" xsi:type="array">
          <item name="dataType" xsi:type="string">text</item>
          <item name="label" xsi:type="string" translate="true">Action</item>
          <item name="disableForDefaultRecord" xsi:type="boolean">true</item>
          <item name="additionalClasses" xsi:type="string">action_delete_button</item>
       </item>
     </argument>
     <settings>
       <imports>
          <link name="hide">${ $.provider}:data.do_we_hide_it</link>                       
       </imports>
     </settings>
 </actionDelete>

<----------- Your code ------->

This code will hide delete action in edit form, but also work in add new form

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.