/**
  * Executed when the user clicks at the action2 button
  */
 public function onAction2()
 {
     $datagrid = new TQuickGrid();
     $datagrid->setHeight(320);
     // add the columns
     $datagrid->addQuickColumn('Code', 'code', 'right', 100);
     $datagrid->addQuickColumn('Name', 'name', 'left', 200);
     // creates the datagrid model
     $datagrid->createModel();
     $object = new StdClass();
     $object->code = '001';
     $object->name = 'Test 001';
     $datagrid->addItem($object);
     $object = new StdClass();
     $object->code = '002';
     $object->name = 'Test 002';
     $datagrid->addItem($object);
     $replace = array();
     $replace['object'] = $datagrid;
     $replace['name'] = 'TQuickGrid';
     // replace the object section variables
     $this->html->enableSection('object', $replace);
 }
Example #2
0
<?php

include 'init.php';
$banco = $_POST['banco'];
$model = $_POST['model'];
//$criterio = $_POST['criterio'];
$campos = $_POST['campos'];
$action = $_POST['action'];
$key = $_POST['key'];
$datagrid = new TQuickGrid();
$fields = unserialize($campos);
$action = unserialize($action);
$criteria = new TCriteria();
$criteria->setProperty('limit', 10);
$repo = new TRepository($model);
foreach ($fields as $c) {
    $datagrid->addQuickColumn($c, $c, 'left', 200);
}
// create the datagrid actions
$timer_action = new TDataGridAction($action);
// add the actions to the datagrid
$datagrid->addQuickAction('action', $timer_action, $key, 'bs:search blue');
$datagrid->createModel();
try {
    TTransaction::open($banco);
    $objects = $repo->load($criteria);
    if ($objects) {
        // iterate the collection of active records
        foreach ($objects as $object) {
            // add the object inside the datagrid
            $datagrid->addItem($object);