Filtering of custom table using a custom block template

Permalink
Hi
I have ventured into working with custom tables, and this is a whole new and exciting territory to me.
I used the 'cookbook event package' and 'database item list' as a base for developing a custom list of retailers package. Also I have used the 'custom object demo' for inspiration.
The package I am crreating contains both dashboard pages for adding and deleting items in the table and a custom block for displaying instances of the table in the frontend.
This works like a charm.

I can easily display all instances from the database in block view using this:
class Retailer extends Model {   
    var $_table = 'Retailers';
}

and
class RetailersBlockController extends BlockController {
    protected $btTable = "btRetailers";
    protected $btInterfaceWidth = "350";
    protected $btInterfaceHeight = "300";
    public function getBlockTypeName() {
        return t('Retailers List');
    }
    public function getBlockTypeDescription() {
        return t('A list of retailers!');
    }
    public function view() {
        Loader::model('retailer', 'retailers');
        $e = new Retailer();
        $events = $e->find('1=1 ORDER BY city');
        $this->set('events', $events);


However, I wish to filter the data using different block view templates.
The same way you would filter data using page_list ($pl = new pageList) on ordinary pages.
And this is where I am stuckt.

I have of course searched wide and far for any hints, but haven't yet figured out how to do it.

In the 'database item list' the following controller is used for filtering the pages:
class RetailersController extends Controller {
   public function view() {  
        $ml = new RetailerList();
        $ml->filter('country', 'Norway', '=');
        $this->set('retailers', $ml->getPage()); // would you use getPage here???
       }
}

But how do I integrate this in my block view????

I have tried putting the above code in the RetailersBlockController, but it outputs an sql error (mysqlt error: [1146:) due to this stament: $this->set('retailers', $ml->getPage());

Any help would be highly appreciated !!

 
tilde replied on at Permalink Reply
Well, just found 'contact directory' add-on, which actually serves my need.
Also I guess I will find answers to my questions by studying the source code.

Best T