Skip to content

Sort order missing on Downloadable Product Links and Sample Columns #21278

Closed
@mahesh-rajawat

Description

@mahesh-rajawat

Preconditions (*)

  1. Magento 2.2
  2. Magento 2.3.0

Steps to reproduce (*)

  1. I need to add a column after Links Title column programatically.
  2. I have created a plugin of
    \Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier\Links::modifyMeta()
namespace Webkul\Test\Plugin\Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier;
use Magento\Catalog\Model\Locator\LocatorInterface;
use Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier\Composite;
use Magento\Framework\Stdlib\ArrayManager;
use Magento\Ui\Component\Container;
use Magento\Ui\Component\Form;
/**
 * Links class
 */
class Links 
{
    /**
     *
     * @param \Webkul\Test\Helper\Data $helper
     */
    public function __construct(
        LocatorInterface $locator,
        ArrayManager $arrayManager,
        \Webkul\Test\Helper\Data $helper
    ) {
        $this->helper = $helper;
        $this->locator = $locator;
        $this->arrayManager = $arrayManager;
    }
    /**
     * @see \Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier\Links::modifyMeta()
     */
    public function afterModifyMeta (
        \Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier\Links $subject,
        $result
    ) {
            $recordPath = $this->arrayManager->findPath('record', $result, null, 'children');
            $result = $this->arrayManager->merge(
                $recordPath.'/children',
                $result,
                array_merge(
                    [
                        'resolution' => $this->getResolutionColumn()
                    ]
                )
                
            );
        return $result;
    }
    /**
     * @return array
     */
    protected function getResolutionColumn()
    {
        $titleContainer['arguments']['data']['config'] = [
            'componentType' => Container::NAME,
            'formElement' => Container::NAME,
            'component' => 'Magento_Ui/js/form/components/group',
            'label' => __('Resolution'),
            'showLabel' => false,
            'dataScope' => '',
            'sortOrder' => 15,
        ];
        $titleField['arguments']['data']['config'] = [
            'formElement' => Form\Element\Input::NAME,
            'componentType' => Form\Field::NAME,
            'dataType' => Form\Element\DataType\Text::NAME,
            'dataScope' => 'resolution',
            'validation' => [
                'required-entry' => true,
            ],
        ];
        return $this->arrayManager->set('children/resolution', $titleContainer, $titleField);
    }
}
  1. After applying this code with sortOrder 15 on this custom column the links table columns misplaced

Expected result (*)

  1. This custom column must be insert after Title Column

Actual result (*)

download

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: DownloadableFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions