Filter not working for a in layout grid (without using layout grid) in magento 2Magento Admin Order Grid...

Is there a frame of reference in which I was born before I was conceived?

It took me a lot of time to make this, pls like. (YouTube Comments #1)

I encountered my boss during an on-site interview at another company. Should I bring it up when seeing him next time?

When was drinking water recognized as crucial in marathon running?

Why is working on the same position for more than 15 years not a red flag?

Did Amazon pay $0 in taxes last year?

Graphing random points on the XY-plane

How do I deal with being jealous of my own players?

Can we carry rice to Japan?

Is knowledge about monster types inherent?

In iTunes 12 on macOS, how can I reset the skip count of a song?

How can atoms be electrically neutral when there is a difference in the positions of the charges?

Six real numbers so that product of any five is the sixth one

Wrap all numerics in JSON with quotes

How to mitigate "bandwagon attacking" from players?

Citing contemporaneous (interlaced?) preprints

Get length of the longest sequence of numbers with the same sign

Make me a metasequence

Is it possible to make a clamp function shorter than a ternary in JS?

Giving a talk in my old university, how prominently should I tell students my salary?

Where is the line between being obedient and getting bullied by a boss?

Why do phishing e-mails use faked e-mail addresses instead of the real one?

How to kill a localhost:8080

How can I create a Table like this in Latex?



Filter not working for a in layout grid (without using layout grid) in magento 2


Magento Admin Order Grid Filter by “Status” giving error while joined with “sales_flat_order” tableHow to add filtering to custom table field column in Customers admin grid in Magento2?Magento 2.1 Create a filter in the product grid by new attributeRound a Magento Attribute in Admin Grid to the second DecimalUncaught Error: Call to a member function setItem() on boolean on product grid: Magento 2Magento 2 : Add values to ui_component fieldsmagento 2.2.5: Adding Custom Attribute to Customer Edit Form in AdminCustom status label not showing on admin grid Magento2Magento 2.3 Can't view module's front end page output?Magento 2 How to remove price filter from category if module is enable?













0















I have created admin grid without using ui component.
I have showed the customer name, email id, approval_status of the customer(which is a customer custom attribute) from customer Model(MagentoCustomerModelCustomerFactory).
Filter works fine for customer name and email id.
But for approval status,filter is not working properly.
Please provide me a solution



grid.php



 $this->addColumn(
'status', [
'header' => __('Status'),
'index' => 'entity_id',//customer id
'type' => 'select',
'filter' => xxyyBlockAdminhtmlzzGridContainerFilterStatus::class,
'renderer' => xxyyBlockAdminhtmlzzGridContainerRendererStatus::class
]
);


Renderer file



use MagentoCustomerModelCustomerFactory;


class Status extends MagentoBackendBlockWidgetGridColumnRendererAbstractRenderer
{

/**
* Render review type
*
* @param MagentoFrameworkDataObject $row
* @return MagentoFrameworkPhrase
*/
protected $model;

public function __construct(CustomerFactory $model)
{
$this->model = $model;

}
public function render(MagentoFrameworkDataObject $row)
{
if ($row->getEntityId()) {
$customerdata = $this->model->create();
$customer = $customerdata->load($row->getEntityId());
$status = $customer->getData('test_status');

if ($status == 1) {
return __('Approved');
}
if($status == 0) {
return __('Not Approved');
}
}


}

}


Filter



class Status extends MagentoBackendBlockWidgetGridColumnFilterSelect
{

/**
* Get grid options
*
* @return array
*/
protected function _getOptions()
{
return [
['label' => __('Approved'), 'value' => 1],
['label' => __('Not Approved'), 'value' => 0]
];
}

/**
* Get condition
*
* @return int
*/
public function getCondition()
{
if ($this->getValue() == 1) {
return 1;
}
if ($this->getValue() == 0) {
return 0;
}
}

}








share



























    0















    I have created admin grid without using ui component.
    I have showed the customer name, email id, approval_status of the customer(which is a customer custom attribute) from customer Model(MagentoCustomerModelCustomerFactory).
    Filter works fine for customer name and email id.
    But for approval status,filter is not working properly.
    Please provide me a solution



    grid.php



     $this->addColumn(
    'status', [
    'header' => __('Status'),
    'index' => 'entity_id',//customer id
    'type' => 'select',
    'filter' => xxyyBlockAdminhtmlzzGridContainerFilterStatus::class,
    'renderer' => xxyyBlockAdminhtmlzzGridContainerRendererStatus::class
    ]
    );


    Renderer file



    use MagentoCustomerModelCustomerFactory;


    class Status extends MagentoBackendBlockWidgetGridColumnRendererAbstractRenderer
    {

    /**
    * Render review type
    *
    * @param MagentoFrameworkDataObject $row
    * @return MagentoFrameworkPhrase
    */
    protected $model;

    public function __construct(CustomerFactory $model)
    {
    $this->model = $model;

    }
    public function render(MagentoFrameworkDataObject $row)
    {
    if ($row->getEntityId()) {
    $customerdata = $this->model->create();
    $customer = $customerdata->load($row->getEntityId());
    $status = $customer->getData('test_status');

    if ($status == 1) {
    return __('Approved');
    }
    if($status == 0) {
    return __('Not Approved');
    }
    }


    }

    }


    Filter



    class Status extends MagentoBackendBlockWidgetGridColumnFilterSelect
    {

    /**
    * Get grid options
    *
    * @return array
    */
    protected function _getOptions()
    {
    return [
    ['label' => __('Approved'), 'value' => 1],
    ['label' => __('Not Approved'), 'value' => 0]
    ];
    }

    /**
    * Get condition
    *
    * @return int
    */
    public function getCondition()
    {
    if ($this->getValue() == 1) {
    return 1;
    }
    if ($this->getValue() == 0) {
    return 0;
    }
    }

    }








    share

























      0












      0








      0








      I have created admin grid without using ui component.
      I have showed the customer name, email id, approval_status of the customer(which is a customer custom attribute) from customer Model(MagentoCustomerModelCustomerFactory).
      Filter works fine for customer name and email id.
      But for approval status,filter is not working properly.
      Please provide me a solution



      grid.php



       $this->addColumn(
      'status', [
      'header' => __('Status'),
      'index' => 'entity_id',//customer id
      'type' => 'select',
      'filter' => xxyyBlockAdminhtmlzzGridContainerFilterStatus::class,
      'renderer' => xxyyBlockAdminhtmlzzGridContainerRendererStatus::class
      ]
      );


      Renderer file



      use MagentoCustomerModelCustomerFactory;


      class Status extends MagentoBackendBlockWidgetGridColumnRendererAbstractRenderer
      {

      /**
      * Render review type
      *
      * @param MagentoFrameworkDataObject $row
      * @return MagentoFrameworkPhrase
      */
      protected $model;

      public function __construct(CustomerFactory $model)
      {
      $this->model = $model;

      }
      public function render(MagentoFrameworkDataObject $row)
      {
      if ($row->getEntityId()) {
      $customerdata = $this->model->create();
      $customer = $customerdata->load($row->getEntityId());
      $status = $customer->getData('test_status');

      if ($status == 1) {
      return __('Approved');
      }
      if($status == 0) {
      return __('Not Approved');
      }
      }


      }

      }


      Filter



      class Status extends MagentoBackendBlockWidgetGridColumnFilterSelect
      {

      /**
      * Get grid options
      *
      * @return array
      */
      protected function _getOptions()
      {
      return [
      ['label' => __('Approved'), 'value' => 1],
      ['label' => __('Not Approved'), 'value' => 0]
      ];
      }

      /**
      * Get condition
      *
      * @return int
      */
      public function getCondition()
      {
      if ($this->getValue() == 1) {
      return 1;
      }
      if ($this->getValue() == 0) {
      return 0;
      }
      }

      }








      share














      I have created admin grid without using ui component.
      I have showed the customer name, email id, approval_status of the customer(which is a customer custom attribute) from customer Model(MagentoCustomerModelCustomerFactory).
      Filter works fine for customer name and email id.
      But for approval status,filter is not working properly.
      Please provide me a solution



      grid.php



       $this->addColumn(
      'status', [
      'header' => __('Status'),
      'index' => 'entity_id',//customer id
      'type' => 'select',
      'filter' => xxyyBlockAdminhtmlzzGridContainerFilterStatus::class,
      'renderer' => xxyyBlockAdminhtmlzzGridContainerRendererStatus::class
      ]
      );


      Renderer file



      use MagentoCustomerModelCustomerFactory;


      class Status extends MagentoBackendBlockWidgetGridColumnRendererAbstractRenderer
      {

      /**
      * Render review type
      *
      * @param MagentoFrameworkDataObject $row
      * @return MagentoFrameworkPhrase
      */
      protected $model;

      public function __construct(CustomerFactory $model)
      {
      $this->model = $model;

      }
      public function render(MagentoFrameworkDataObject $row)
      {
      if ($row->getEntityId()) {
      $customerdata = $this->model->create();
      $customer = $customerdata->load($row->getEntityId());
      $status = $customer->getData('test_status');

      if ($status == 1) {
      return __('Approved');
      }
      if($status == 0) {
      return __('Not Approved');
      }
      }


      }

      }


      Filter



      class Status extends MagentoBackendBlockWidgetGridColumnFilterSelect
      {

      /**
      * Get grid options
      *
      * @return array
      */
      protected function _getOptions()
      {
      return [
      ['label' => __('Approved'), 'value' => 1],
      ['label' => __('Not Approved'), 'value' => 0]
      ];
      }

      /**
      * Get condition
      *
      * @return int
      */
      public function getCondition()
      {
      if ($this->getValue() == 1) {
      return 1;
      }
      if ($this->getValue() == 0) {
      return 0;
      }
      }

      }






      grid filter magento2.3 customer-attribute grid-layout





      share












      share










      share



      share










      asked 4 mins ago









      JaisaJaisa

      8521936




      8521936






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "479"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f264593%2ffilter-not-working-for-a-in-layout-grid-without-using-layout-grid-in-magento-2%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f264593%2ffilter-not-working-for-a-in-layout-grid-without-using-layout-grid-in-magento-2%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

          How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

          夢乃愛華...