4

I'm trying to insert a listing (grid) inside my edit form fieldset.

<fieldset name="printingtable_colors_one" sortOrder="100">
    <settings>
        <collapsible>false</collapsible>
        <label translate="true">Kleuren 1</label>
    </settings>
    <insertListing>
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array"><item name="autoRender" xsi:type="string">true</item>
                <item name="ns" xsi:type="string">{{name of grid}}</item>
            </item>
        </argument>
    </insertListing>
</fieldset>

This is what i have now. But nothing is showing.

<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<argument name="data" xsi:type="array">
    <item name="js_config" xsi:type="array">
        <item name="provider" xsi:type="string">printing_printingtable_grid.printing_printingtable_grid_source</item>
        <item name="deps" xsi:type="string">printing_printingtable_grid.printing_printingtable_grid_data_source</item>
    </item>
    <item name="spinner" xsi:type="string">printing_printingtable_grid_columns</item>
    <item name="buttons" xsi:type="array">
        <item name="add" xsi:type="array">
            <item name="name" xsi:type="string">add</item>
            <item name="label" xsi:type="string" translate="true">Add New Data</item>
            <item name="class" xsi:type="string">primary</item>
            <item name="url" xsi:type="string">*/costs/add</item>
        </item>
    </item>
</argument>
<dataSource name="sample_data_grid_data_source">
    <argument name="dataProvider" xsi:type="configurableObject">
        <argument name="class" xsi:type="string">PrintingTableGridDataProvider</argument>
        <argument name="name" xsi:type="string">printing_printingtable_grid_data_source</argument>
        <argument name="primaryFieldName" xsi:type="string">spd_id</argument>
        <argument name="requestFieldName" xsi:type="string">spd_id</argument>
        <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="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
                <item name="storageConfig" xsi:type="array">
                    <item name="indexField" xsi:type="string">sqd_id</item>
                </item>
            </item>
        </argument>
    </argument>
</dataSource>

<container name="listing_top">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="template" xsi:type="string">ui/grid/toolbar</item>
            <item name="stickyTmpl" xsi:type="string">ui/grid/sticky/toolbar</item>
        </item>
    </argument>
    <bookmark name="bookmarks">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="storageConfig" xsi:type="array">
                    <item name="namespace" xsi:type="string">sample_data_grid</item>
                </item>
            </item>
        </argument>
    </bookmark>
    <component name="columns_controls">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="columnsData" xsi:type="array">
                    <item name="provider" xsi:type="string">printing_printingtable_grid.printing_printingtable_grid.sample_data_grid_columns</item>
                </item>
                <item name="component" xsi:type="string">Magento_Ui/js/grid/controls/columns</item>
                <item name="displayArea" xsi:type="string">dataGridActions</item>
            </item>
        </argument>
    </component>
    <paging name="listing_paging">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="storageConfig" xsi:type="array">
                    <item name="provider" xsi:type="string">printing_printingtable_grid.printing_printingtable_grid.listing_top.bookmarks</item>
                    <item name="namespace" xsi:type="string">current.paging</item>
                </item>
                <item name="selectProvider" xsi:type="string">printing_printingtable_grid.printing_printingtable_grid.printing_printingtable_grid_columns.ids</item>
            </item>
        </argument>
    </paging>
</container>

<columns name="printing_printingtable_grid_columns">

    <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">spd_id</item>
            </item>
        </argument>
    </selectionsColumn>

    <column name="spd_id">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="filter" xsi:type="string">textRange</item>
                <item name="sorting" xsi:type="string">asc</item>
                <item name="label" xsi:type="string" translate="true">Data ID</item>
            </item>
        </argument>
    </column>
    <column name="title">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="filter" xsi:type="string">text</item>
                <item name="sorting" xsi:type="string">asc</item>
                <item name="label" xsi:type="string" translate="true">Druktabel</item>
            </item>
        </argument>
    </column>

    <actionsColumn name="actions" class="Shirtsbedrukken\PrintingTable\Ui\Component\Listing\Columns\PrintingTableActions" sortOrder="200">
        <settings>
            <indexField>spd_id</indexField>
        </settings>
    </actionsColumn>

</columns>

If i paste this in then it doesn't load my data. But i know this isn't the way to go either.

2
<insertListing name="testListingInsert">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="autoRender" xsi:type="boolean">true</item>
            <item name="ns" xsi:type="string">{{ name of configured Listing Ui Component }}</item>
        </item>
    </argument>
</insertListing>

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.