Skip to content

Instantly share code, notes, and snippets.

@romaninsh
Created November 1, 2010 02:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romaninsh/657513 to your computer and use it in GitHub Desktop.
Save romaninsh/657513 to your computer and use it in GitHub Desktop.
Simple Grid on Agile Toolkit , PHP5
<?php
$g=$p->add('Grid');
// All the new views or objects needs to be added. When you do that - new object becomes child. This determines location where it appears on the page.
// For example $p is the "Demo" tab. What you add into $p will always be in there.
$g->addColumn('name');
// You can define multiple columns inside grid using addColumn() method. Columns must correspond with the hash keys in the data
$g->addColumn('surname');
// There are 3 ways how you bind Grid with source. 1: Set static source, 2: Set data table through dynamic query, 3: Assign model through controller
// Here we are using #1
$g->setStaticSource(array(
array('name'=>'John','surname'=>'Smith'.rand(1,20)),
array('name'=>'Peter','surname'=>'Tester'.rand(20,40))
));
@romaninsh
Copy link
Author

@romaninsh
Copy link
Author

runs on Agile Toolkit: http://github.com/atk4/atk4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment