28 Jan 2010 @ 3:55 PM 

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.

Filtered grid sample

Posted By: Zayin
Last Edit: 28 Jan 2010 @ 03:55 PM

EmailPermalinkComments (2)
Tags
Tags: ,
Categories: php, rapyd

 Last 50 Posts
 Back
Change Theme...
  • Users » 1
  • Posts/Pages » 38
  • Comments » 57
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

Links



    No Child Pages.

Portfolio



    No Child Pages.