Skip to content

Instantly share code, notes, and snippets.

@pavelkucera
Created August 30, 2010 20:54
Show Gist options
  • Save pavelkucera/558033 to your computer and use it in GitHub Desktop.
Save pavelkucera/558033 to your computer and use it in GitHub Desktop.
// Create a query
$ds = \dibi::dataSource('SELECT p.*, c.[name] as city FROM [people] p LEFT JOIN [cities] c ON p.[city_id] = c.[id]');
// Create a data source
$dataSource = new \DataGrid\DataSources\Dibi\DataSource($ds);
// Configure data grid
$grid = new DataGrid;
$grid->setDataSource($dataSource);
// Configure columns
$grid->addNumericColumn('id', 'ID')->addFilter();
$grid->addColumn('name', 'Jméno')->addFilter();
$grid->addColumn('mail', 'E-mail')->addFilter();
$grid->addColumn('city', 'Město')->addFilter();
$grid->addDateColumn('registered', 'Registrován')->addFilter();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment