Magento – Filtering custom model

filtermodel

i have a custom model that i want to display in a page-anted grid for users on a page in storefront. i can call the collection in the phtml with a filter and it works, but when i move the call to the block it does not work if i try to filter (i can call the whole collection just when i add the filter it stops working)the collection any ideas? this is the call

Mage::getModel('model/name')->getCollection()->addFilter('group_id', $val);

Best Answer

Use addFieldToFilter instead of addFilter:

Mage::getModel('model/name')->getCollection()->addFieldToFilter('group_id', $val);