2

I have used the below code in view :

<exportButton name="export_button">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="selectProvider" xsi:type="string">pos_outlet_listing.pos_outlet_listing.pos_outlet_columns.ids</item>
                </item>
            </argument>
</exportButton>

Got Error:

Notice: Undefined index: attributes in /home/yaboow/public_html/demo/vendor/magento/framework/View/Element/UiComponentFactory.php on line 176

version 2.3

Is there anything i have missed!!?

  • Have you add column of primary key in your listing grid? – Rutvee Sojitra Jan 1 at 4:50
  • '<argument name="requestFieldName" xsi:type="string">id</argument> <argument name="primaryFieldName" xsi:type="string">id</argument>' added like this under data source tag – Mohammed Aslam Jan 1 at 5:23
  • Can you please your listing file code.So i can help you – Rutvee Sojitra Jan 1 at 5:27
  • github.com/azlamptb/Magento You can see the file here – Mohammed Aslam Jan 1 at 5:36
  • <!-- <selectionsColumn name="ids"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="resizeEnabled" xsi:type="boolean">false</item> <item name="resizeDefaultWidth" xsi:type="string">55</item> <item name="indexField" xsi:type="string">id</item> </item> </argument> </selectionsColumn> --> just uncomment this your code will work as expected – Rutvee Sojitra Jan 1 at 5:50
2
       <!-- <selectionsColumn name="ids"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="resizeEnabled" xsi:type="boolean">false</item> <item name="resizeDefaultWidth" xsi:type="string">55</item> <item name="indexField" xsi:type="string">id</item> </item> </argument> </selectionsColumn> -->

You just need to remove comment form above code. Because UiComponentFactory.php take Data of array from it and pass this data to it's parent

     public function __construct(
    ObjectManagerInterface $objectManager,
    ManagerInterface $componentManager,
    InterpreterInterface $argumentInterpreter,
    ContextFactory $contextFactory,
    array $data = [],
    array $componentChildFactories = [],
    DataInterface $definitionData = null,
    DataInterfaceFactory $configFactory = null
) {
    $this->objectManager = $objectManager;
    $this->componentManager = $componentManager;
    $this->argumentInterpreter = $argumentInterpreter;
    $this->contextFactory = $contextFactory;
    $this->componentChildFactories = $componentChildFactories;
    $this->configFactory = $configFactory ?: $this->objectManager->get(DataInterfaceFactory::class);

parent::__construct($data);

            $this->definitionData = $definitionData ?:
        $this->objectManager->get(DataInterface::class);
}

And it's parent class

Magento\Framework\DataObject

data set in SetData function

  • hi @Rutvee, I am also facing same issue, but i do not see any code like that in my listing.xml, the export is working well only i need to change the csv file to store in media directory – jafar pinjar Jul 29 at 11:11

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.