17

To me, that main difference is that the Magento/Framework/View/Element/UiComponent/DataProvider/DataProvider uses the Search API. The following classes are used in this class : Magento\Framework\Api\FilterBuilder Magento\Framework\Api\Search\ReportingInterface Magento\Framework\Api\Search\SearchCriteria Magento\Framework\Api\Search\SearchCriteriaBuilder ...


15

Not sure if this will completely solve your problem, but it should take you a step further. Add this method in your data provider public function addFilter(\Magento\Framework\Api\Filter $filter) { return null; } Since you are extending AbstractDataProvider you need to override the method. If something else crashes, you might need to do the same thing ...


11

In your custom_form.xml file <field name="your_field_id"> <argument name="data" xsi:type="array"> <item name="options" xsi:type="object">{Vendorname}\{Modulename}\Model\Classname</item> <item name="config" xsi:type="array"> <item name="dataType" xsi:type="string"...


8

If you use setting tags in ui-component. You need to add data return include fieldset. Example field "priority" will show "name='general['priority']' " Your loadedData in function getData() should like this: $this->loadedData[$page->getId()]['general'] = $page->getData();


6

Change class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider To class DataProvider extends \Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider


6

After reading and debugging the Magento 2 core files I have found a clean and simple solution about this issue. Passing data from a custom form to a custom grid using the UIComponent insertListing is really hard and not documented at all. The InsertListing object has two parameters under the tag: exports and imports that I have used in my listing: <...


6

Finally, this worked for me: changing Vendor/Module/etc/adminhtml/di.xml to <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <virtualType name="Vendor\Module\Ui\DataProvider\Item\Form\Modifier\Pool" type="Magento\Ui\DataProvider\Modifier\Pool"&...


5

Magento 2 has "head.additional" block, where you can set your variables globally. Add below code in app\code\Name\Module\view\frontend\templates\globalvar/globalvariable.phtml ?php $globalConfig = []; $globalConfig['FirstVariable'] = 'My first value'; $globalConfig['SecondVariable'] = 'My second value'; ?> <script> window.globalConfigData = <?...


5

For add insert listing by param of parent ui-component we can use below code. Here externalProvider tag is for add source provider of the listing which we are inserting. Here imports tag is used for import param of the current form data source Here exports tag is used for export the current form data params to the listing which going to be insert. <...


5

My main problem that DataProvider::getData() function weren't executed was because it didn't know which row to populate. When I added /settings_id/1/ into an url then this function was called. And return value should be set like this: return [1 => ['settings' => $item]] where [$selectedId => [$fieldsetName => $ArrayOfitemValues]] I hope it helps ...


4

It turns out that the problem is, that i was trying to pass array with integers to the component. In case the ui-select is multiselect: <item name="multiple" xsi:type="boolean">true</item> this doesn't work. What works is passing array with string values: ['7', '9'] Not sure why that is. If the select is not multiselect: <item name="...


4

You can create a custom js component based on the one you are using. It is quite simple considering the example of the select component. We are using a collection's source model and our modules' ui-form. Example of the component in the xml file (ui): <fieldset name="general"> <field name="methods"> <argument name="data" xsi:type="...


4

You can add a URL parameter to the submit URL more easily using a button adapter as follows: public function getButtonData() { return [ 'label' => __('Save'), 'class' => 'save', 'on_click' => '', 'sort_order' => 80, 'data_attribute' => [ ...


3

For sku generation has settings: Stores -> Configuration -> Catalog Change Mask for SKU to somedigits_{{name}} [Update] SKU js component: Magento_Catalog/js/components/import-handler Location: vendor/magento/module-catalog/view/adminhtml/web/js/components/import-handler.js Overwrite this component what you want here.


3

Try with following updated code. namespace Vendor\Module\Ui\DataProvider\Customer\Form; use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory; use Magento\Ui\DataProvider\AbstractDataProvider; use Magento\Ui\DataProvider\Modifier\ModifierInterface; use Magento\Ui\DataProvider\Modifier\PoolInterface; /** * DataProvider for product edit ...


3

You can set default value from below code. Update modifyMeta function from like this. public function __construct( \Magento\Framework\Stdlib\ArrayManager $arrayManager ) { $this->arrayManager = $arrayManager; } public function modifyMeta(array $meta) { $fieldCode = 'custom_fieldset'; $elementPath = $this->arrayManager->findPath($...


3

We can not extend only private function . if we want to extend private function we have to extend public function which call that private function. so after calling both function in file i got success in extend. other than this code is right and working fine.


3

Just inject your collection factory class in the constructor of your dataprovider and assign the collection member variable with your collection. It should resolve the issue. Best <?php /** * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ namespace Company_Name\ProductParser\Model; use Magento\Ui\DataProvider\...


3

you can do so just by checking if your Entity id exists In your data provider. public function getData() { if (!empty($this->loadedData)) { return $this->loadedData; } $items = $this->collection->getItems(); foreach ($items as $page) { $rec = $page->getData(); $rec['edit'] = true; // true when the data is set ...


2

From both the comments and question I understand that problem is populating the form when a new entity is created not at edit. The answer is really simple. Structure your create url in the following manner: www.website.[com|org|etc]/[admin]/[front-name]/[controller]/[action]/[requestFieldName]/0/[params ..] Then when returning $loadedData from you ...


2

Check following function /** * {@inheritdoc} */ public function getDataSourceData() { $dataSource = []; $id = $this->getContext()->getRequestParam($this->getContext()->getDataProvider()->getRequestFieldName(), null); $filter = $this->filterBuilder->setField($this->getContext()->getDataProvider()->getPrimaryFieldName()) ->setValue($id) ...


2

The Abstract Data Provider that you are extending has collection field. You must initialize this field with a valid collection (the collection associated with your entity). Steps to solve the problem. Inject collectionFactory in the class that extends AbstractDataProvider. Initialize $collection field. The error message is pretty intuitive too. (By ...


2

You final getData() look like this public function getData() { if (isset($this->_loadedData)) { return $this->_loadedData; } //Get the collection. $items = $this->collection->getItems(); $slide = array(); foreach ($items as $item) { $this->_loadedData[$item->getId()]['general'] = $item->getData(); ...


2

Maybe not exact answer but it works. Case though XML There is an answer in magento2/module-cms. Basically, there is responsible configuration for that: <virtualType name="CmsGirdFilterPool" type="Magento\Framework\View\Element\UiComponent\DataProvider\FilterPool"> <arguments> <argument name="appliers" ...


2

If you have a requirement as load an admin grid with pre-defined multiple filter values like below: <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="update_url" xsi:type="url" path="mui/index/render"/> <item name="filter_url_params" xsi:type="array"> <item ...


2

They were empty because the primaryFieldName and requestFieldName had wrong values. Instead of entity_id in my case i need to change it to simply id.


2

Add Following code in app/code/Vendor/Module/view/adminhtml/ui_component/category_form.xml <?xml version="1.0" encoding="UTF-8"?> <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <settings> <buttons> <button ...


1

You can update your dataSource content with this content <dataSource name="vendor_module_categoryimages_listing"> <argument name="dataProvider" xsi:type="configurableObject"> <argument name="class" xsi:type="string">Magento\Catalog\Model\Category\DataProvider</argument> <argument name="name" xsi:type="string"&...


1

> /** > * DataProvider constructor. > * @param $name < > * @param $primaryFieldName < > * @param $requestFieldName < > * @param Helper $helper > * @param Session $session > * @param array $addFieldStrategies > * @param array $...


1

Finally, I have found the solution for this. It's really good which I didn't believe that it can be such easier. Here, is the solution which you need to put in your ui component grid listing xml file: Inside the <dataSource> tag : <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="...


Only top voted, non community-wiki answers of a minimum length are eligible