jqh 5 лет назад
Родитель
Сommit
d102b70802
2 измененных файлов с 22 добавлено и 4 удалено
  1. 0 2
      src/Grid/Displayers/Modal.php
  2. 22 2
      src/Widgets/Form.php

+ 0 - 2
src/Grid/Displayers/Modal.php

@@ -11,8 +11,6 @@ class Modal extends AbstractDisplayer
 {
 {
     protected $title;
     protected $title;
 
 
-    protected $renderable;
-
     public function title(string $title)
     public function title(string $title)
     {
     {
         $this->title = $title;
         $this->title = $title;

+ 22 - 2
src/Widgets/Form.php

@@ -657,7 +657,7 @@ HTML;
     /**
     /**
      * @return void
      * @return void
      */
      */
-    protected function setupSubmitScript()
+    protected function setUpSubmitScript()
     {
     {
         Admin::script(
         Admin::script(
             <<<JS
             <<<JS
@@ -665,9 +665,11 @@ $('#{$this->getElementId()}').form({
     validate: true,
     validate: true,
     success: function (data) {
     success: function (data) {
         {$this->buildSuccessScript()}
         {$this->buildSuccessScript()}
+        {$this->addSavedScript()}
     },
     },
     error: function (response) {
     error: function (response) {
         {$this->buildErrorScript()}
         {$this->buildErrorScript()}
+        {$this->addErrorScript()}
     }
     }
 });
 });
 JS
 JS
@@ -676,6 +678,8 @@ JS
 
 
     /**
     /**
      * @return string|void
      * @return string|void
+     *
+     * @deprecated 将在2.0版本中废弃,请用 addSavedScript 代替
      */
      */
     protected function buildSuccessScript()
     protected function buildSuccessScript()
     {
     {
@@ -684,10 +688,26 @@ JS
     /**
     /**
      * @return string|void
      * @return string|void
      */
      */
+    protected function addSavedScript()
+    {
+    }
+
+    /**
+     * @return string|void
+     *
+     * @deprecated 将在2.0版本中废弃,请用 addErrorScript 代替
+     */
     protected function buildErrorScript()
     protected function buildErrorScript()
     {
     {
     }
     }
 
 
+    /**
+     * @return string|void
+     */
+    protected function addErrorScript()
+    {
+    }
+
     /**
     /**
      * @param array $input
      * @param array $input
      *
      *
@@ -737,7 +757,7 @@ JS
         $this->prepareHandler();
         $this->prepareHandler();
 
 
         if ($this->allowAjaxSubmit()) {
         if ($this->allowAjaxSubmit()) {
-            $this->setupSubmitScript();
+            $this->setUpSubmitScript();
         }
         }
 
 
         $tabObj = $this->getTab();
         $tabObj = $this->getTab();