Skip to content

Commit 315658a

Browse files
authored
Merge pull request #2150 from deflinhec/2.0
修正 Grid 以 LazyRenderable 呈現時 Group Filter 沒有正確篩選
2 parents 8900283 + 1927cb6 commit 315658a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Grid/Filter/Group.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public function condition($inputs)
256256

257257
$this->value = $value;
258258

259-
$group = Arr::get($inputs, "{$this->id}_group");
259+
$group = Arr::get($inputs, "{$this->sanitizeId()}_group");
260260

261261
if ($this->group->isEmpty()) {
262262
call_user_func($this->builder, $this);
@@ -267,6 +267,18 @@ public function condition($inputs)
267267
}
268268
}
269269

270+
/**
271+
* Sanitize the filter id.
272+
*
273+
* @return string
274+
*/
275+
protected function sanitizeId()
276+
{
277+
if ($prefix = $this->parent()->grid()->getNamePrefix())
278+
return str_replace($prefix, '', $this->id);
279+
return $this->id;
280+
}
281+
270282
/**
271283
* Inject script to current page.
272284
*/

0 commit comments

Comments
 (0)