You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/filters.md
-44Lines changed: 0 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -209,50 +209,6 @@ public function buildFilterConfig(): void
209
209
}
210
210
```
211
211
212
-
## Filter template
213
-
214
-
Sometimes you need your select filter results to be a little more than a label. For this, configure a template (similar to form fields with templates):
You can also, for more control, return a view here.
224
-
225
-
The template will be [interpreted by Vue.js](https://vuejs.org/v2/guide/syntax.html), meaning you can add data placeholders, DOM structure but also directives, and anything that Vue will parse. It's the same as [Autocomplete's templates](form-fields/autocomplete.md).
226
-
227
-
You'll need also to change your `values()` function, returning more than an `[{id}=>{value}]` array. For instance:
228
-
229
-
```php
230
-
public function values()
231
-
{
232
-
return ProductCategory::orderBy('label')
233
-
->get()
234
-
->map(function ($category) {
235
-
return [
236
-
'id' => $category->id,
237
-
'label' => $category->label,
238
-
'detail' => $category->detail_text
239
-
];
240
-
});
241
-
}
242
-
```
243
-
244
-
Note that **the label attribute is mandatory**: it is used for the result display of the filter.
245
-
246
-
Finally, if your filter is also searchable, you'll need to configure attributes which should be searched in the template:
247
-
248
-
```php
249
-
public function buildFilterConfig(): void
250
-
{
251
-
$this->configureSearchable()
252
-
->configureSearchKeys(['label', 'detail']);
253
-
}
254
-
```
255
-
256
212
## Check filter
257
213
258
214
In case of a filter that is just a matter on true / false ("only show admins" for example), just make your filter class extend `Code16\Sharp\EntityList\Filters\EntityListCheckFilter`.
Copy file name to clipboardExpand all lines: docs/guide/upgrading/9.0.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -234,8 +234,6 @@ $instance: // the **Customer** instance
234
234
$attribute: 'name'
235
235
```
236
236
237
-
238
-
239
237
### Thumbnails custom filters must be refactored to Modifiers
240
238
241
239
First, if you defined custom filters classes for your thumbnails, you must refactor it to the new ThumbnailModifier API, which is very close:
@@ -472,6 +470,10 @@ class PostBlockList extends SharpEntityList
472
470
473
471
You can of course instead declare a real Filter.
474
472
473
+
### Select filter `configureTemplate()` has been dropped
474
+
475
+
If you were using this method, you must do the string transformation in the label of each value.
476
+
475
477
### New performance optimization for Commands and Policies in Entity List (n+1)
476
478
477
479
This is not a breaking change, in fact you can ignore this step entirely, but since it's can lead to a significative performance boost, this is worth mentioning: you can now quite easily implement a [caching mechanism of instances for your Commands and Policies in Entity List](../avoid-n1-queries-in-entity-lists.md).
0 commit comments