Multicolumncombobox Error: Provided data must consist only of objects

1 Answer 102 Views
MultiColumnComboBox
Jörg
Top achievements
Rank 1
Iron
Jörg asked on 21 Mar 2023, 01:48 PM

Hello,

I ran into an issue using the multicolumncombobox. I want to fill this dropdown with data rertrieved from my Rest API Java backend. Although the data shows up, I get an error in my console looking like this:

core.mjs:8453 ERROR Error: Provided data must consist only of objects. See https://www.telerik.com/kendo-angular-ui/components/dropdowns/multicolumncombobox/data-binding/
    at MultiColumnComboBoxComponent.verifySettings (progress-kendo-angular-dropdowns.mjs:9690:19)
    at MultiColumnComboBoxComponent.ngAfterContentChecked (progress-kendo-angular-dropdowns.mjs:4400:14)

...

Here's my template code:


<kendo-multicolumncombobox
      #list
      [data]="list"
      [listHeight]="300"
      textField="name"
      valueField="customerid"
    >
    
    <kendo-combobox-column field="name" title="name" [width]="200">
    </kendo-combobox-column>
    <kendo-combobox-column field="customerid" title="ID" [width]="200">
    </kendo-combobox-column>

My component:

list: Customer[]=[];
...
constructor(private api:CustomerService){
      this.api.getAllCustomer(this.params).subscribe((resp) => {
        this.list = resp;
        tap(()=>this.loading = false)
      });
    }

CustomerService:

 public getAllCustomer(params: any): Observable<Customer[]> {
   params.pldId='23';
    return this.api.getAllCustomer(params);
  }

The backend an retrieving the data from the backend works fine. However, the multicolumncombobox doen't really like my Array.

If I replace the list with the data from the example, it does work without an error (thats the prodictsliste from https://www.telerik.com/kendo-angular-ui/components/dropdowns/multicolumncombobox/). MAybe noteworthy, that my backend produces response of "application/son".

Any help is greatly appreciated!

Cheers,

Joerg

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Jörg
Top achievements
Rank 1
Iron
answered on 22 Mar 2023, 09:07 AM

I figured it out myself but wanted to answer in case someone else runs into the same problem. The solution is rather simple: In the code mentionend, there was a "NULL" value in the database for the field "custermerid". Somehow, one of the database records had a null value there. When I deleted the record, everything worked as expected. The errormessage "data must consist only of objects" could be clearer because it led me into a complete othere direction. 8-]

Cheers,

Joerg

 

Tags
MultiColumnComboBox
Asked by
Jörg
Top achievements
Rank 1
Iron
Answers by
Jörg
Top achievements
Rank 1
Iron
Share this question
or