Created
November 1, 2010 02:42
-
-
Save romaninsh/657513 to your computer and use it in GitHub Desktop.
Simple Grid on Agile Toolkit , PHP5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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)) | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In action: http://demo.atk4.com/demo.html?t=1