This is a migrated thread and some comments may be shown as answers.

AutoComplete load items from google spreadsheet

1 Answer 115 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
yudha
Top achievements
Rank 1
yudha asked on 22 Jul 2020, 03:07 AM

Hi,

I have following code:

01.var arrlistNamaKaryawan;
02.
03.google.script.run.withSuccessHandler(populateNamaKaryawan).getNamaKaryawanReceived();
04.   
05.var dataSource = new kendo.data.DataSource({data : arrlistNamaKaryawan});      
06.   
07.// create a new widget instance
08.$("#employee").kendoAutoComplete({ dataSource: dataSource });
09.   
10. // retrieve the widget instance
11. var empAutoComplete = $("#employee").getKendoAutoComplete();
12.
13.function populateNamaKaryawan(listNamaKaryawan){
14.   console.log(listNamaKaryawan);
15.   console.log(Object.keys(listNamaKaryawan));
16.   console.log(Object.values(listNamaKaryawan));
17.   console.log(Object.entries(listNamaKaryawan));
18.    console.log(arrAnimal);

 

19.   arrlistNamaKaryawan = Object.keys(listNamaKaryawan);
20.   //arrlistNamaKaryawan = listNamaKaryawan;
21.}
22.
23.function getNamaKaryawanReceived(){
24.    var ss = SpreadsheetApp.openByUrl(urlStockBarangIT);
25.    var ws = ss.getSheetByName("Master Karyawan");
26.    var data = ws.getRange(2, 2, 3, 1).getValues();
27.
28.    var options = {};
29.    data.forEach(function(v){
30.         options[v[0]] = null; //convert to object
31.    });
32.
33.    console.log(options);
34.    return options;
35.
36.    //console.log(data);
37.    //return data;
38.}

 

But my #employee AutoComplete still no data

Thank you

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 23 Jul 2020, 12:27 PM

Hello Yudha,

As far as I see from the screenshots, you are setting the dataSource by using the data option. Form the provided information I am not sure what is the structure of value used for the data option of the data source. Could you please make sure that an array of JavaScript objects is set to the data option as explained in the article linked here? Note, that in case the data is not present in a plain array of objects, setting a schema is required. Please refer to the following link from DataSource documentation.

Here is a Dojo example where the DataSource of the AutoComplete is set by using the data option.

In addition, below you will find some threads from our Forum where similar issues have been discussed.

- https://www.telerik.com/forums/dropdownlist-not-populating-with-data-from-datasource

- https://www.telerik.com/forums/remote-datasource-not-populating-dropdownlist

I hope you will find the provided information helpful.

Regards,
Neli
Progress Telerik

Tags
AutoComplete
Asked by
yudha
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or