0

Here i have to add filter in charity and fee column,if charity is filled then display in grid otherwise that data should not show in grid.

But all record's are displayed. I have 2 order in one order charity is applied. I want to display only that order wich charity is applied. please help..

Thank you.. Here i have 2 order in one order charity is applied. I want to display only that order wich charity is applied.

0

Add below code in 'Model/ResourceModel/Grid/Collection' file for filter grid

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_id'])) {
       $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
       $product = $objectManager- >get('Magento\Catalog\Model\ProductFactory')->create()
        ->getCollection()
        ->addAttributeToFilter('sku', ['eq'=>$filters['product_id']])->getFirstItem();
    $this->getSelect()->orWhere("product_id = '" . $product->getId() .   "'");
 }
parent::_renderFiltersBefore();}   

But its not working for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy