public function generateInner() { $id = $this->getId(); $value = $this->getValue(); $numFields = count($this->fields); // fields $fields = ''; $n = 1; $ref = ''; $totalWidth = 0; foreach ($this->fields as $f) { $ref .= ($ref ? ',' : '') . $f->getName(); $f->form = $this->form; $f->setLabel(htmlspecialchars($f->label)); //$f->formMode = 2; $fields[] = $f; $totalWidth += $width[] = $f->width ?: '15'; $n++; } $btnInsert = new MButton("{$id}_btnInsert", 'Inserir', "!{$id}_ajaxInsert();"); $actionInsert = MAction::getHref($this->actionInsert); $this->page->addJsCode("{$id}_ajaxInsert = function() { manager.doAjaxText('{$actionInsert}', '{$id}_divGrid', '{$id}_btnInsert') };"); $fields[] = $btnInsert; $field = new MContentPane("{$id}_divGrid"); $select = $field; $btnDelete = new MButton("{$id}_btnDelete", 'Remover selecionados', "!{$id}_ajaxDelete();"); $actionDelete = MAction::getHref($this->actionDelete); $this->page->addJsCode("{$id}_ajaxDelete = function() { manager.doAjaxText('{$actionDelete}', '{$id}_divGrid', '{$id}_btnDelete') };"); // layout $t = array(); $array[] = new MDiv('', new MHContainer("{$id}_containerFields", $fields)); $array[] = new MDiv('', $select); $array[] = new MDiv('', $btnDelete); $container = new MVContainer('', $array); $group = new MBaseGroup('', $this->getCaption(), $container); if (strpos($this->actionGrid, Manager::getBaseURL()) !== false) { $actionGrid = $this->actionGrid; } else { $actionGrid = MAction::getHref($this->actionGrid . ($value ? '/' . $value : '')); } $this->page->onLoad(MUI::set("{$id}_divGrid", 'href', $actionGrid) . ';'); $div = new MDiv($this->name, $group); $div->attributes = clone $this->attributes; $div->style = clone $this->style; $div->setClass('mGridField'); $this->inner = array($div); return $this->inner; }