Ver código fonte

Filter::multipleSelectTable调整

jqh 4 anos atrás
pai
commit
e963801759

+ 1 - 1
resources/views/widgets/dialogtable.blade.php

@@ -112,7 +112,7 @@
     }
 
     function setMaxHeight(index) {
-        var maxHeight = ($(window).height() - 250);
+        var maxHeight = ($(window).height() - 220);
         if (maxHeight < 250) {
             maxHeight = maxHeight + 120;
         }

+ 6 - 1
src/Grid/Actions/QuickEdit.php

@@ -37,6 +37,11 @@ class QuickEdit extends RowAction
             'data-url' => "{$this->resource()}/{$this->getKey()}/edit",
         ]);
 
-        return parent::render(); // TODO: Change the autogenerated stub
+        return parent::render();
+    }
+
+    public function makeSelector()
+    {
+        return 'quick-edit';
     }
 }

+ 1 - 1
src/Grid/Concerns/HasSelector.php

@@ -58,7 +58,7 @@ trait HasSelector
                 return;
             }
 
-            $this->fireOnce(new Grid\Events\ApplySelector($this));
+            $this->fireOnce(new Grid\Events\ApplySelector($this, [$active]));
 
             $values = $active[$key];
             if ($selector['type'] == 'one') {

+ 11 - 10
src/Grid/Filter/Presenter/MultipleSelectTable.php

@@ -37,16 +37,17 @@ class MultipleSelectTable extends SelectTable
 
         Admin::script(
             <<<JS
-{$this->dialog->getScript()}
-
-Dcat.grid.SelectTable({
-    dialog: '#{$this->dialog->id()}',
-    container: '#{$this->id}',
-    input: '#hidden-{$this->id}',
-    multiple: true,
-    max: {$this->max},
-    values: {$options},
-});
+Dcat.init('#{$this->id}', function (self) {
+    var dialogId = self.parent().find('{$this->dialog->getElementSelector()}').attr('id');
+    Dcat.grid.SelectTable({
+        dialog: '[data-id="' + dialogId + '"]',
+        container: '#{$this->id}',
+        input: '#hidden-{$this->id}',
+        multiple: true,
+        max: {$this->max},
+        values: {$options},
+    });
+})
 JS
         );
     }

+ 0 - 1
src/Http/Controllers/UserController.php

@@ -54,7 +54,6 @@ class UserController extends AdminController
             $grid->quickSearch(['id', 'name', 'username']);
 
             $grid->showQuickEditButton();
-            $grid->disableFilterButton();
             $grid->enableDialogCreate();
             $grid->showColumnSelector();