0

enter image description here

this is add new form this is working.

<field name="available_time">
    <argument name="data" xsi:type="array">
        <item name="options" xsi:type="object">Testing\AB\Model\Config\Source\AvailableTime</item>
        <item name="config" xsi:type="array">
            <item name="additionalClasses" xsi:type="string">required</item>
            <item name="dataType" xsi:type="string">text</item>
            <item name="label" xsi:type="string" translate="true">Available Time</item>
            <item name="componentType" xsi:type="string">field</item>
            <item name="formElement" xsi:type="string">select</item>
            <item name="component" xsi:type="string">Magento_Ui/js/form/element/ui-select</item>
            <item name="elementTmpl" xsi:type="string">ui/grid/filters/elements/ui-select</item>
            <item name="dataScope" xsi:type="string">available_time</item>
            <item name="filterOptions" xsi:type="boolean">true</item>
            <item name="showCheckbox" xsi:type="boolean">true</item>
            <item name="disableLabel" xsi:type="boolean">true</item>
            <item name="multiple" xsi:type="boolean">true</item>
            <item name="levelsVisibility" xsi:type="number">1</item>
            <item name="sortOrder" xsi:type="number">70</item>
            <item name="required" xsi:type="boolean">true</item>
            <item name="validation" xsi:type="array">
                <item name="required-entry" xsi:type="boolean">false</item>
            </item>
            
        </item>
    </argument>
</field>

But edit this is not working . select radio not checked.

enter image description here

5
  • Please share you Dataprovider file.
    – Msquare
    Jun 26, 2023 at 10:24
  • edit area select option click not work. Jun 26, 2023 at 10:33
  • public function getData() { if (isset($this->loadedData)) { return $this->loadedData; } $items = $this->collection->getItems(); foreach ($items as $blog) { $this->loadedData[$blog->getId()] = $blog->getData(); } return $this->loadedData; } Jun 26, 2023 at 10:34
  • The invalid option value pass in the employee status field That's why it's not working.
    – Msquare
    Jun 26, 2023 at 10:35
  • Please check my updated answer and update me if still has an issue.
    – Msquare
    Jun 26, 2023 at 10:40

1 Answer 1

0

You have to update your data provider file for this. Available time must be passed as an array. Right now it's a string that's why you can not see selected options.

Sample Code

public function getData() {
    if (isset($this->loadedData)) {
        return $this->loadedData;
    }

    $items = $this->collection->getItems();
    foreach ($items as $blog) {
        $blog->setData('emp_status', explode(',', $blog->getData('emp_status') ?? ''));
        $this->loadedData[$blog->getId()] = $blog->getData();
    }
    return $this->loadedData;
}

You can replace emp_status with your column employee status column name

1
  • public function getData() { if (isset($this->loadedData)) { return $this->loadedData; } $items = $this->collection->getItems(); foreach ($items as $blog) { $this->loadedData[$blog->getId()] = $blog->getData(); } return $this->loadedData; } Jun 26, 2023 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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