I have a custom entity listed by ui component. By default it loads the entire collection as shown in every tutorial as the virtual type is just an alias for the current collection.
<type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
<arguments>
<argument name="collections" xsi:type="array">
<item name="cpy_miseenavant_listing_data_source" xsi:type="string">CpyMiseEnAvantModelResourceModelMiseEnAvantGridCollection</item>
</argument>
</arguments>
</type>
<virtualType name="NespressoMiseEnAvantModelResourceModelMiseEnAvantGridCollection"
type="MagentoFrameworkViewElementUiComponentDataProviderSearchResult">
<arguments>
<argument name="mainTable" xsi:type="string">products_homepage</argument>
<argument name="resourceModel" xsi:type="string">CpyMiseEnAvantModelResourceModelMiseEnAvantCollection</argument>
</arguments>
</virtualType>
But what I need to achieve is to prevent the admin from one store to see the values from an other store. (I have a store_id field).
But I don’t know how to achieve that…in which moment I can update the collection before she is print on the listing.
In my adding form I have this element which is the one I should use in the listing for pre-filtering
<field name="store_id">
<argument name="data" xsi:type="array">
<item name="options" xsi:type="object">MagentoCmsUiComponentListingColumnCmsOptions</item>
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">int</item>
<item name="label" xsi:type="string" translate="true">Store View</item>
<item name="formElement" xsi:type="string">select</item>
<item name="source" xsi:type="string">products_homepage</item>
<item name="dataScope" xsi:type="string">store_id</item>
<item name="default" xsi:type="string">0</item>
<item name="validation" xsi:type="array">
<item name="required-entry" xsi:type="boolean">true</item>
</item>
</item>
</argument>
</field>