I try it but not working. everyone can help me plz! enter image description here
Muhammad Anas
1,4673 gold badges13 silver badges33 bronze badges
3 Answers 3
If you are using magento2.3.1 need to change your filed component code in xml file like below
<field name="sort_order" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">page</item>
</item>
</argument>
<settings>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
<dataType>text</dataType>
<label translate="true">Sort Order</label>
<dataScope>sort_order</dataScope>
<imports>
<link name="disabled">${ $.provider}:data.do_we_hide_it</link>
</imports>
</settings>
</field>
answered May 24, 2019 at 4:29
Rutvee Sojitra
3,9092 gold badges21 silver badges59 bronze badges
-
your dataProvider code will remain same... just change your filed code like aboveRutvee Sojitra– Rutvee Sojitra2019年05月24日 04:30:50 +00:00Commented May 24, 2019 at 4:30
-
Do you know hidden fieldset ?NewBie– NewBie2019年05月24日 06:10:10 +00:00Commented May 24, 2019 at 6:10
-
@NewBie means? what is your requirement?Rutvee Sojitra– Rutvee Sojitra2019年05月24日 06:12:50 +00:00Commented May 24, 2019 at 6:12
-
1I want hide tab in form ui components.NewBie– NewBie2019年05月24日 06:14:16 +00:00Commented May 24, 2019 at 6:14
-
@NewBie Please add new question ... If not me other can help you!!Rutvee Sojitra– Rutvee Sojitra2019年05月24日 06:18:55 +00:00Commented May 24, 2019 at 6:18
You can override getMeta() function in your DataProvider class
public function getMeta()
{
$meta = parent::getMeta();
$id = $this->request->getParam('entity_id');
if(isset($id)){
$meta['fieldset_name']['arguments']['data']['config']['visible'] = 1;
}
else{
$meta['fieldset_name']['arguments']['data']['config']['visible'] = 0;
}
return $meta;
}
This worked for me.
answered Sep 7, 2020 at 5:09
Smita Kagwade
1,4633 gold badges20 silver badges41 bronze badges
You need to add the class into the fieldset tab as below.
<fieldset name="testingproduct" class="Vendor\Module\Ui\Component\Custom\Form\CustomFieldset">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
...
You need to add the fieldset condition in the specified class.
<?php
namespace Vendor\Module\Ui\Component\Custom\Form;
use Magento\Framework\View\Element\UiComponent\ContextInterface;
use Magento\Ui\Component\Form\Fieldset;
class CustomFieldset extends Fieldset
{
public function __construct(
ContextInterface $context,
array $components = [],
array $data = []
) {
$this->context = $context;
parent::__construct($context, $components, $data);
}
//This method is responsible for show and hide the fieldset
public function prepare()
{
$visiable = false; // do some work to get boolean value;
$config = $this->getData('config');
$config['visible'] = $visiable;
$this->setData('config', $config);
parent::prepare();
}
}
Thanks :)
default