src/CRUD.php
public function initUpdate()
    {
        $this->addAction(['icon' => 'edit'], new jsModal('Edit', $this->pageUpdate, [$this->name => $this->jsRow()->data('id'), $this->name.'_sort' => $this->getSortBy()]));

        $this->pageUpdate->set(function () {
            $this->model->load($this->app->stickyGet($this->name));

            // Maybe developer has already created form
            if (!is_object($this->formUpdate) || !$this->formUpdate->_initialized) {
                $this->formUpdate = $this->pageUpdate->add($this->formUpdate ?: $this->formDefault);
            }

            $this->formUpdate->setModel($this->model, $this->fieldsUpdate ?: $this->fieldsDefault);

            if ($sortBy = $this->getSortBy()) {
                $this->formUpdate->stickyGet($this->name.'_sort', $sortBy);
            }

            // set save handler with reload trigger
            // adds default submit hook if it is not already set for this form
            if (!$this->formUpdate->hookHasCallbacks('submit')) {
                $this->formUpdate->onSubmit(function ($form) {
                    $form->model->save();

                    return $this->jsSaveUpdate();
                });
            }
        });
    }
public function initUpdate()
    {
        $this->addAction(['icon' => 'edit'], new jsModal('Edit', $this->pageUpdate, [$this->name => $this->jsRow()->data('id'), $this->name.'_sort' => $this->getSortBy()]));

        $this->pageUpdate->set(function () {
            $this->model->load($this->app->stickyGet($this->name));

            // Maybe developer has already created form
            if (!is_object($this->formUpdate) || !$this->formUpdate->_initialized) {
                $this->formUpdate = $this->pageUpdate->add($this->formUpdate ?: $this->formDefault);
            }

            $this->formUpdate->setModel($this->model, $this->fieldsUpdate ?: $this->fieldsDefault);

            if ($sortBy = $this->getSortBy()) {
                $this->formUpdate->stickyGet($this->name.'_sort', $sortBy);
            }

            // set save handler with reload trigger
            // adds default submit hook if it is not already set for this form
            if (!$this->formUpdate->hookHasCallbacks('submit')) {
                $this->formUpdate->onSubmit(function ($form) {
                    $form->model->save();

                    return $this->jsSaveUpdate();
                });
            }
        });
    }
public function initUpdate ( ) { $ this -> addAction ( [ 'icon' => 'edit' ] , new jsModal ( 'Edit' , $ this -> pageUpdate , [ $ this -> name => $ this -> jsRow ( ) -> data ( 'id' ) , $ this -> name . '_sort' => $ this -> getSortBy ( ) ] ) ) ; $ this -> pageUpdate -> set ( function ( ) { $ this -> model -> load ( $ this -> app -> stickyGet ( $ this -> name ) ) ; // Maybe developer has already created form if ( ! is_object ( $ this -> formUpdate ) || ! $ this -> formUpdate -> _initialized ) { $ this -> formUpdate = $ this -> pageUpdate -> add ( $ this -> formUpdate ? : $ this -> formDefault ) ; } $ this -> formUpdate -> setModel ( $ this -> model , $ this -> fieldsUpdate ? : $ this -> fieldsDefault ) ; if ( $ sortBy = $ this -> getSortBy ( ) ) { $ this -> formUpdate -> stickyGet ( $ this -> name . '_sort' , $ sortBy ) ; } // set save handler with reload trigger // adds default submit hook if it is not already set for this form if ( ! $ this -> formUpdate -> hookHasCallbacks ( 'submit' ) ) { $ this -> formUpdate -> onSubmit ( function ( $ form ) { $ form -> model -> save ( ) ; return $ this -> jsSaveUpdate ( ) ; } ) ; } } ) ; }
Initializes interface elements for editing records.

@return array|jsExpression
Initializes interface elements for editing records .