one magento developer

my experiences about magento

change default ui component filter search in magento

here is a good code to change the default ui component filter that i wanna shear it with you. you can change it as you wish. put it in collection class.

    protected function _renderFiltersBefore() {

        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $request = $objectManager->get('Magento\Framework\App\Request\Http');
        $filters = $request->getParam("filters");

        if (isset($filters['product_name'])) {
            $this->getSelect()->orWhere("product_name = '%" . $filters['product_name'] . "%'");
        }

        parent::_renderFiltersBefore();
    }

Leave a Reply

Your email address will not be published. Required fields are marked *.

*
*
You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>