Add display count. Fix #41
This commit is contained in:
parent
eccd2d0cf2
commit
42315226bd
@ -156,12 +156,15 @@ sort:
|
|||||||
reverse: <reverse>
|
reverse: <reverse>
|
||||||
ignore_case: <ignore_case>
|
ignore_case: <ignore_case>
|
||||||
attribute: <attribute>
|
attribute: <attribute>
|
||||||
|
first: <first>
|
||||||
|
count: <count>
|
||||||
```
|
```
|
||||||
|
|
||||||
- `method:` **Required** One of `domain`, `entity_id`, `name`, `state` or `attribute`
|
- `method:` **Required** One of `domain`, `entity_id`, `name`, `state` or `attribute`
|
||||||
- `reverse:` Set to `true` to reverse the order. Default: `false`.
|
- `reverse:` Set to `true` to reverse the order. Default: `false`.
|
||||||
- `ignore_case:` Set to `true` to make the sort case-insensitive. Default: `false`.
|
- `ignore_case:` Set to `true` to make the sort case-insensitive. Default: `false`.
|
||||||
- `attribute:` Attribute to sort by if `method: attribute`. Can be an *object attribute* as above (e.g. `attribute: rgb_color:2`)
|
- `attribute:` Attribute to sort by if `method: attribute`. Can be an *object attribute* as above (e.g. `attribute: rgb_color:2`)
|
||||||
|
- `first` and `count` can be used to only display `<count>` entities, starting with the `<first>` (starts with 0).
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -81,6 +81,10 @@ class AutoEntities extends LitElement {
|
|||||||
if(this._config.sort) {
|
if(this._config.sort) {
|
||||||
// Sort everything
|
// Sort everything
|
||||||
entities = entities.sort(entity_sorter(this.hass, this._config.sort));
|
entities = entities.sort(entity_sorter(this.hass, this._config.sort));
|
||||||
|
if(this._config.sort.count) {
|
||||||
|
const start = this._config.sort.first || 0;
|
||||||
|
entities = entities.slice(start, start + this._config.sort.count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._config.unique) {
|
if(this._config.unique) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user