Example #1
0
 /**
  * Add action to the datagrid
  * @param $label  Action Label
  * @param $action TAction Object
  * @param $icon   Action Icon
  */
 public function addQuickAction($label, TDataGridAction $action, $field, $icon = NULL)
 {
     $action->setLabel($label);
     if ($icon) {
         $action->setImage($icon);
     }
     $action->setField($field);
     // add the datagrid action
     parent::addAction($action);
 }
Example #2
0
 /**
  * 
  */
 public function makeTDataGrid($properties)
 {
     $table = new TTable();
     $widget = new TDataGrid();
     $widget->setHeight((string) $properties->{'height'});
     if ($properties->{'columns'}) {
         foreach ($properties->{'columns'} as $Column) {
             $dgcolumn = new TDataGridColumn((string) $Column->{'name'}, (string) $Column->{'label'}, (string) $Column->{'align'}, (string) $Column->{'width'});
             $widget->addColumn($dgcolumn);
             $this->fieldsByName[(string) $Column->{'name'}] = $dgcolumn;
         }
     }
     if ($properties->{'actions'}) {
         foreach ($properties->{'actions'} as $Action) {
             $dgaction = new TDataGridAction(array($this->controller, (string) $Action->{'method'}));
             $dgaction->setLabel((string) $Action->{'label'});
             $dgaction->setImage((string) $Action->{'image'});
             $dgaction->setField((string) $Action->{'field'});
             $widget->addAction($dgaction);
             //$this->fieldsByName[(string)$properties->Name] = $column;
         }
     }
     if ((string) $properties->{'pagenavigator'} == 'yes') {
         $loader = (string) $properties->{'loader'} ? (string) $properties->{'loader'} : 'onReload';
         $pageNavigation = new TPageNavigation();
         $pageNavigation->setAction(new TAction(array($this->controller, $loader)));
         $pageNavigation->setWidth($widget->getWidth());
     }
     $widget->createModel();
     $row = $table->addRow();
     $row->addCell($widget);
     if (isset($pageNavigation)) {
         $row = $table->addRow();
         $row->addCell($pageNavigation);
         $widget->setPageNavigation($pageNavigation);
     }
     $this->fieldsByName[(string) $properties->{'name'}] = $widget;
     $widget = $table;
     return $widget;
 }