문제

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.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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top