Sfoglia il codice sorgente

grid row action bug修复

jqh 5 anni fa
parent
commit
7eb870c650

+ 4 - 2
resources/assets/dcat/extra/grid-row-action.js

@@ -31,7 +31,7 @@
                     return;
                 }
 
-                if (options.before(data, target) === false) {
+                if (options.before(data, target, _this) === false) {
                     return;
                 }
 
@@ -57,7 +57,7 @@
         }
 
         _resolver() {
-            let options = this.options;
+            let _this = this, options = _this.options;
 
             return function (result) {
                 var response = result[0],
@@ -109,6 +109,8 @@
         }
 
         _reject() {
+            let options = this.options;
+
             return function (result) {
                 var request = result[0], target = result[1];
 

File diff suppressed because it is too large
+ 0 - 0
resources/dist/dcat/extra/grid-row-action.js


File diff suppressed because it is too large
+ 0 - 0
resources/dist/dcat/extra/grid-row-action.js.map


+ 9 - 3
src/Actions/HasActionHandler.php

@@ -97,17 +97,21 @@ JS;
     }
 
     /**
+     * 设置动作发起请求前的回调函数,返回false可以中断请求.
+     *
      * @return string
      */
     protected function actionScript()
     {
         // 发起请求之前回调,返回false可以中断请求
         return <<<'JS'
-function (data, target) { }
+function (data, target, action) { }
 JS;
     }
 
     /**
+     * 设置请求成功回调,返回false可以中断默认的成功处理逻辑.
+     *
      * @return string
      */
     protected function resolverScript()
@@ -119,11 +123,12 @@ JS;
     }
 
     /**
+     * 处理接口返回的HTML代码.
+     *
      * @return string
      */
     protected function handleHtmlResponse()
     {
-        // 处理返回的HTML代码
         return <<<'JS'
 function (target, html, data) {
     target.html(html);
@@ -132,11 +137,12 @@ JS;
     }
 
     /**
+     * 设置请求出错回调,返回false可以中断默认的错误处理逻辑.
+     *
      * @return string
      */
     protected function rejectScript()
     {
-        // // 请求出错回调,返回false可以中断默认的错误处理逻辑
         return <<<'JS'
 function (target, results) {}
 JS;

Some files were not shown because too many files changed in this diff