Exemplo n.º 1
0
 public function setModel($model)
 {
     parent::setModel($model);
     $self = $this;
     // Add button - open dialog for adding new element
     $this->addButton()->set('+')->add('VirtualPage')->bindEvent($this->form_title, 'click')->set(function ($page) use($self) {
         $form = $page->add($this->form_class);
         $form->setModel($self->model);
         $form->addSubmit('Save');
         if ($form->isSubmitted()) {
             $form->update();
             $js = array($self->js()->val($form->model[$self->id_field]), $self->other_field->js()->val($form->model[$self->title_field]));
             $form->js(null, $js)->univ()->closeDialog()->execute();
         }
     });
 }
Exemplo n.º 2
0
 function setModel($model)
 {
     parent::setModel($model);
     $self = $this;
     $f = $this->other_field;
     // Add buttonset to name field
     $bs = $f->afterField()->add('ButtonSet');
     // Add button - open dialog for adding new element
     $bs->add('Button')->set('+')->add('VirtualPage')->bindEvent('Add New Record', 'click')->set(function ($page) use($self) {
         $form = $page->add('Form');
         $form->setModel($self->model);
         if ($form->isSubmitted()) {
             $form->update();
             $js = array();
             $js[] = $self->js()->val($form->model[$self->id_field]);
             $js[] = $self->other_field->js()->val($form->model[$self->title_field]);
             $form->js(null, $js)->univ()->closeDialog()->execute();
         }
     });
 }