This is a beta release of documentation for Magento 2.4, published for previewing soon-to-be-released functionality. Content in this version is subject to change. Links to the v2.4 code base may not properly resolve until the code is officially released.

GridDataProvider component

The GridDataProvider UI component is a data provider for the Listing component. It provides data in specific format which is shared among all UI components in the scope of the Listing component.

Configuration options

Option Description Type Default Value
class Path to the PHP class responsible for the backend implementation of the component String Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider
component The path to the component’s .js file, relative to RequireJS. String Magento_Ui/js/grid/provider
firstLoad Defines the first loading of data. The value changes to false if data reloads. Boolean true
lastError Defines if an error occurred for the latest data reloading. Boolean false
storageConfig Configuration of the GridDataStorage component. Object {component: 'Magento_Ui/js/grid/data-storage',provider: '${ $.storageConfig.name }',name: '${ $.name }_storage',updateUrl: '${ $.update_url }'}

Sources files

Extends UiElement:

Examples

Integrate the GridDataProvider component with the Listing component

This is an example of how the GridDataProvider component integrates with the Listing component:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<listing>
    <dataSource name="listing_data_source" component="Magento_Ui/js/grid/provider">
        <settings>
            <storageConfig>
                <param name="indexField" xsi:type="string">entity_id</param>
            </storageConfig>
            <updateUrl path="mui/index/render"/>
        </settings>
        <aclResource>Vendor_Module::resource</aclResource>
        <dataProvider class="Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider" name="listing_data_source">
            <settings>
                <requestFieldName>id</requestFieldName>
                <primaryFieldName>entity_id</primaryFieldName>
            </settings>
        </dataProvider>
    </dataSource>
    ...
</listing>