1

Faced the problem that filterSearch does not search for all columns in the table ,but search only works in one column in the table grid.

I installed full text in database columns

My code filterSearch

<filterSearch name="fulltext" >
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="component" xsi:type="string">Magento_Ui/js/grid/search/search</item>
                <item name="displayArea" xsi:type="string">dataGridFilters</item>
                <item name="provider" xsi:type="string">magento_retailmanager_post_listing.magento_retailmanager_post_listing_data_source</item>
                <item name="chipsProvider" xsi:type="string">magento_retailmanager_post_listing.magento_retailmanager_post_listing.listing_top.listing_filters_chips</item>
                <item name="storageConfig" xsi:type="array">
                    <item name="provider" xsi:type="string">magento_retailmanager_post_listing.magento_retailmanager_post_listing.listing_top.bookmarks</item>
                    <item name="namespace" xsi:type="string">current.search</item>
                </item>
            </item>
        </argument>
    </filterSearch>

Example code created column on UI component

 <column name="model">
        <argument name="data" xsi:type="array">
            <item name="width" xsi:type="string">150px</item>
            <item name="config" xsi:type="array">
                <item name="filter" xsi:type="string">text</item>
                <item name="component" xsi:type="string">Magento_Ui/js/grid/columns/column</item>
                <item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
                <item name="sortable" xsi:type="boolean">true</item>
                <item name="dataType" xsi:type="string">text</item>
                <item name="align" xsi:type="string">left</item>
                <item name="label" xsi:type="string" translate="true">model</item>
            </item>
        </argument>
    </column>

And is it possible to search for information by type LIKE ? And is it possible to search for digital data in the table?

4

To make full text search or keyword search of admin grid you need to make or add index of the table

$connection->addIndex(
                    'your table name', //table name
                    'index',    // index name
                    [
                        'field or your column name'   // field or column name which is needed for searching enter all columns to be searched 
                    ],
                    \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_FULLTEXT //type of index
                );

you can write this code in your install schema or in upgrade schema

Then add this line in your UI component xml file

 <filterSearch name="fulltext"/>

this line you can add in this way

<listingToolbarname="listing_top">
<columnsControls ="columns_control"/>
 <filterSearch name="fulltext"/>
</listingToolbarname/>

Hope this will help you !! Happy Coding :)

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.