Question

I'm doing "search by fulltext" in "Banner Slider" module, and every thing works perfect, but when i click on "x" button to reset the search, it return exactly the same slide as the last slide which in the result. For example, i have 2 slide, "banner_1" and "banner_2" and after i search for "banner_1" (ofcause it work), and then i click on "x" button, and it return 2 "banner_1" (watch the image below):
enter image description here

EDIT 1:

Here is my xml file.

C:\xampp\htdocs\magento\app\code\Aht\BannerSlider\view\adminhtml\ui_component\banner_listing.xml

<dataSource name="banner_listing_data_source" component="Magento_Ui/js/grid/provider">
    <settings>
        <updateUrl path="mui/index/render"/>
    </settings>
    <aclResource>Aht_BannerSlider::banners</aclResource>
    <dataProvider class="Aht\BannerSlider\Ui\Component\DataProvider" name="banner_listing_data_source">
        <settings>
            <requestFieldName>id</requestFieldName>
            <primaryFieldName>id</primaryFieldName>
        </settings>
    </dataProvider>
</dataSource>
Was it helpful?

Solution

After ajax request it is showing the same. Same problem occur to me and here what i do to solve problem. Added below code

<item name="storageConfig" xsi:type="array">
     <item name="indexField" xsi:type="string">yourtableprimaridher</item>
</item>

in you dataSource node.

<dataSource name="test_listing_data_source">
    <argument name="dataProvider" xsi:type="configurableObject">
        <argument name="class" xsi:type="string">testGridDataProvider</argument>
        <argument name="name" xsi:type="string">test_listing_data_source</argument>
        <argument name="primaryFieldName" xsi:type="string">test_id</argument>
        <argument name="requestFieldName" xsi:type="string">test_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="storageConfig" xsi:type="array">
                    <item name="indexField" xsi:type="string">test_id</item>
                </item>
            </item>
        </argument>
    </argument>
   <argument name="data" xsi:type="array">
        <item name="js_config" xsi:type="array">
            <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
        </item>
    </argument>
</dataSource>

This will solve your problem.

Update code for 2.2.5

       <settings>
            <storageConfig>
               <param name="indexField" xsi:type="string">test_id</param>
            </storageConfig>
            <updateUrl path="mui/index/render"/>
        </settings>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top