Open jicksonjohnson opened 2 months ago
I need to keep the column filter open, like below
I did this by editing the vendor files.
`/**
@return $this */ public function open_filter($builder = null) { return $this->addOpenFilter(...func_get_args()); }`
`protected function addOpenFilter($type = null, $formal = null) { if (is_array($type)) { return $this->addHeader(new CheckOpenFilter($type)); }
if (is_null($type)) {
$type = 'equal';
}
if (in_array($type, ['equal', 'like', 'date', 'time', 'datetime'])) {
return $this->addHeader(new InputOpenFilter($type));
}
if ($type === 'range') {
if (is_null($formal)) {
$formal = 'equal';
}
return $this->addHeader(new RangeOpenFilter($formal));
}
return $this;
}`
Updated the inline styling of ul dropdown-menu class element with below
style="padding: 10px;box-shadow: 0 2px 3px 0 rgba(0,0,0,.2);left: -5px;border-radius: 0; display: block; position: relative;"
display and position updated.
Now, I achieved this by editing vendor files. However, this approach is not allowed and is generally considered a bad practice to meet this requirement. As I mentioned in my question, I was unable to achieve the same result using the rewrite method.
If anyone knows of a better approach to accomplish this without editing the vendor files, please advise.
Description:
I am trying to add a new column filter. To achieve this, I need to place a new method similar to "filter" that exists in "Encore\Admin\Grid\Column". Since this is part of a vendor package, I cannot edit it directly. Therefore, my plan is to rewrite this vendor class. I tried using the following code in "AdminServiceProvider". This is a new ServiceProvider I added under config/app.php to make this change.
public function boot() { Admin::booting(function () { $this->app->singleton(\Encore\Admin\Grid\Column::class, \App\Admin\Extensions\Override\Grid\Column::class); }); }
Here my try is to rewrite vendor class method "filter"
`<?php
namespace App\Admin\Extensions\Override\Grid;
use Encore\Admin\Grid\Column as OriginalColumn;
class Column extends OriginalColumn { /**
I do not see this change reflected. Could someone help me with rewriting this vendor class?