DropDownList's datasource is undefined

1 Answer 32 Views
DropDownList
kva
Top achievements
Rank 2
Iron
Iron
Iron
kva asked on 19 Sep 2023, 06:50 AM

I need to find refresh values of DropDownList programmatically. That's what I tried:

		    let nameDropDownList = $('#Configs').getKendoDropDownList();
			console.log(nameDropDownList);
			console.log(nameDropDownList.datasource);
		    nameDropDownList.datasource.read();	
            nameDropDownList.value(currentConfigName);

When read is called, I get:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'read')

Log shows me, that datasource is undefined.

DropDownList definition:
            @(Html.Kendo().DropDownList()
                .Name("Configs")
                .DataTextField("Name")
                .DataValueField("Name")
                .Filter(FilterType.StartsWith)
                .DataSource(s =>
                {
                    s.Read(r => r.Action("Read", "FilteringTable"));
                }))
Read method simply returns all entities of type FilteringTable.

1 Answer, 1 is accepted

Sort by
0
Accepted
kva
Top achievements
Rank 2
Iron
Iron
Iron
answered on 22 Sep 2023, 09:18 AM
It should be `dataSource` not `datasource`. There are mistakes in documentation.
Stoyan
Telerik team
commented on 26 Sep 2023, 08:26 AM

Thanks for your feedback.

Could you please share links with the pages where you found mistaken code snippets in the documentation?

This information allows us to mend the issue to avoid misleading in the future. 

Regards,
Stoyan

Tags
DropDownList
Asked by
kva
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
kva
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or