Grido\Components\Columns\Editable::handleEditable PHP Метод

handleEditable() публичный Метод

public handleEditable ( $id, $newValue, $oldValue )
    public function handleEditable($id, $newValue, $oldValue)
    {
        $this->grid->onRender($this->grid);
        if (!$this->presenter->isAjax() || !$this->isEditable()) {
            $this->presenter->terminate();
        }
        $success = $this->editableCallback ? call_user_func_array($this->editableCallback, [$id, $newValue, $oldValue, $this]) : $this->grid->model->update($id, [$this->getColumn() => $newValue], $this->grid->primaryKey);
        if (is_callable($this->customRender)) {
            $row = $this->editableRowCallback ? call_user_func_array($this->editableRowCallback, [$id, $this]) : $this->grid->model->getRow($id, $this->grid->primaryKey);
            $html = call_user_func_array($this->customRender, [$row]);
        } else {
            $html = $this->formatValue($newValue);
        }
        $payload = ['updated' => (bool) $success, 'html' => (string) $html];
        $response = new \Nette\Application\Responses\JsonResponse($payload);
        $this->presenter->sendResponse($response);
    }