1

I have created a custom collection using Varien_Data_Collection. I am using this collection in a Grid. Everything works fine if I load the page without any filter but when tried to filter a column then pagination count was not showing fine. it's showing only 1 instead of 3 pages but there are 68 items in the collection and the count was also wrong.

When i tried to change the limit, then the values are displaying in the same page.

    protected function initColumns()
    {
      parent::initColumns();
      $columns['email_attribute']=  array(
            'header' => 'Email Filter',
            'index' => 'email_attribute',
            'filter_condition_callback' => array($this, '_filterSponsortEmail'),
      );


    } 
    protected function _filterSponsortEmail($collection, $column)
    {
        $tmp = new Varien_Data_Collection();
        $this->getCollection()->setPageSize(5);
        foreach ($this->getCollection()->getItems() as $item) {
            if($item['email_attribute'] =="2") {
                $tmp->addItem($item);
            }
        }

        $this->setCollection($tmp);        
        return $this;
    }  

Your Answer

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

Browse other questions tagged or ask your own question.