This post deals with adding filters to a grid so that you can filter the result set. The reason for this is that you might have large grids (eg 100 000 items) and you dont necessarily want to search through all that info to get to the row you want to view/edit
$filter = new datafilter_library(); $filter->label = 'User Filter'; $filter->db->select('user.*, customer.company_name, customer.trading_entity_type_id'); $filter->db->from('user'); $filter->db->join('customer', 'user.customer_id = customer.customer_id'); $filter->field('dropdown', 'trading_entity_type_id', 'Trading Entity Type') ->options(array('1'=>'Associate', '2'=>'Wholesaler', '3'=>'Retailer')); $filter->field('input','company_name','Company Name');//->attributes(array('style' => 'width:170px')); $filter->field('input','user_name','User Name'); $filter->field('input','user_idnumber','ID Number'); $filter->field('input','email','email'); $filter->buttons('reset','search'); $filter->build(); $grid = new datagrid_library(); $grid->label = $this->title; $grid->source($filter); $grid->column('company_name','company'); |
Notice that the grid is no longer linked to a query, but is linked to the filter.

Categories
Tag Cloud
Blog RSS
Comments RSS
Last 50 Posts
Back
Void « Default
Life
Earth
Wind
Water
Fire
Light 