Skip to content
This repository was archived by the owner on Dec 30, 2022. It is now read-only.
This repository was archived by the owner on Dec 30, 2022. It is now read-only.

TypeError: Cannot read property 'filter' of undefined at ComboBoxComponent #33

Description

@RobertoDavila

Hi.

I found a issue when you load data from a server and you have filter=true, it displays this error:

<combo-box [listData]="brands" (onSelect)="selectValue()" [localFilter]="true" [displayField]="'brand_name'" [valueField]="'brand_id'" [(ngModel)]="brand">

ERROR TypeError: Cannot read property 'filter' of undefined
at ComboBoxComponent

On the component I found the issue:

private loadData() {
    if (!this.remote) {
        if (this.localFilter) {
            this.data = this._initialData.filter((item) => {

If we validate this._initialData as well we will avoid the error:

private loadData() {
    if (!this.remote) {
        if (this.localFilter && this._initialData) {
            this.data = this._initialData.filter((item) => {

Is it possible that you add this to the code?

Regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions