title: How to create filter_condition_callback on custom renderer in Magento admin grid?
body: <p>I have added custom column to Customer Grid:</p>
  
  <pre><code>    $this-&gt;addColumn('shipping_name', array(
          'header'    =&gt; Mage::helper('customer')-&gt;__('Shipping name'),
          'index'     =&gt; 'entity_id',
          'renderer'  =&gt; new My_Unique_Block_Customer_Renderer_Shippingname(),
          'filter_condition_callback' =&gt; array($this, '_shippingNameFilter')
      ));
  </code></pre>
  
  <p>and the renderer Shippingname.php looks like:</p>
  
  <pre><code>class My_Unique_Block_Customer_Renderer_Shippingname extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
  
  public function render(Varien_Object $row)
  {
  
      $id = $row-&gt;getData($this-&gt;getColumn()-&gt;getIndex());
  
      $customer = Mage::getModel('customer/customer')-&gt;load($id); //customer id
  
      $data = "";
  
      if ( $customer-&gt;getDefaultShippingAddress() != null ) {
          $shipping_address = $customer-&gt;getDefaultShippingAddress();
  
          if ( $shipping_address-&gt;getFirstname() != null ) {
              $data .= $shipping_address-&gt;getFirstname();
          }
  
          if ( $shipping_address-&gt;getLastname() != null ) {
  
              if ( $shipping_address-&gt;getFirstname() != null ) {
                  $data .= " ";
              }
  
              $data .= $shipping_address-&gt;getLastname();
          }
  
      }
  
      return $data;
  }}
  </code></pre>
  
  <p>What should I substitute to function _shippingNameFilter() instead of "shipping_name like ?" to get filter in this column to work?</p>
  
  <pre><code>    protected function _shippingNameFilter($collection, $column)
  {
      if (!$value = $column-&gt;getFilter()-&gt;getValue()) {
          return $this;
      }
      $this-&gt;getCollection()-&gt;getSelect()-&gt;where("shipping_name like ?", "%$value%");
  
      return $this;
  }
  </code></pre>
  
  <p>Thanks!</p>