@(Html.Kendo().DropDownList()
.Name("UnselectedADGroups")
.DataTextField("Name")
.DataValueField("Name")
.Filter("StartsWith")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetUnselectedADGroups", "ARItemPost");
}
)
.ServerFiltering(true);
})
)
I have the following in my controller:
public
ActionResult GetUnselectedADGroups([DataSourceRequest]DataSourceRequest request,
string
startsWith)
{
try
{
var groups = ARItemPost.GetUnselectedADGroups(startsWith);
var result = groups.ToDataSourceResult(request);
return
Json(result, JsonRequestBehavior.AllowGet);
}
catch
(Exception e)
{
ErrorSignal.FromCurrentContext().Raise(e);
return
null
;
}
}
I have verified that I'm getting results back from the AJAX call (it's a collection of a simple object with a single public string property called "Name"), but the dropdown list does not populate and I get an "Object doesn't support property or method 'slice'" error on the "i_pristineData=n.slice(0);" line of [I think] kendo.all.min.js.
6 Answers, 1 is accepted


Thanks Darryl
To the Telerik Team: I waste a lot of time due to the fact
a) that remote datasources are handled differently depending on which widget you use (which from proper modular software design aspects is HELL)
b) that the documentation is far from beeing systematic.
For this particular Problem of a drop down list editor in a Grid my solution was (after wasting 4 hours finding it out):
1) do not use "type: odata" although I had a beautiful Odata Service for exactly the data required
2) prepare a separate json service that serves the data as a list, this because Kendo NEVER calls the data functions in the schema description to extract the data for the list properly.
This is not a professional API's behaviour! Please, Telerik Team: Clean up the datasource code and provide homgeneous usage of the datasource in EVERY widget. By being consistent, you can systematically document the api and once someone has understood the (though important) datasource concept, he or she does not need to read through inumberable examples and stackoverflow posts get it to work. And really: if I build a OData Web Service Infrastructure, there is no sense in serving the same data on a second address via simple JSON. Or do I miss a point here???
Regards
Martin
Thank you for the feedback. Indeed there is a difference between CRUD "enabled" widgets (like Grid, ListView and etc) and "read-only" widgets, like DropDownList for instance.
A simpler "read-only" data source builder was implemented for the so called "read-only" widgets in order to bind them only to a data list (the total field was not required for instance). Thus we insured an easier upgrade path for the developers that were using Telerik extensions for ASP.NET MVC (the library before Kendo UI).
I agree with you that providing a consistent configuration is better and will be better for developers that starts with the library. Unfortunately, such modification will be a major breaking change that we cannot introduce without the support of the community. That being said, would it be possible to share your thoughts and suggestion in our Feedback portal?
With regards to the specific question, the widget can be bound to a ODATA service as it is shown in our Kendo UI demos. What you need to do is to specify the concrete data source type using custom DataSource builder. You can find more details about different DropDownList binding options in its Overview help topic.
Regards,
Georgi Krustev
Telerik

Thank you for this clarification. In this regard I have another brain-teaser for you :
If you have a Grid with a Odata data source containing a column with a dropdown list, again with a remote data source : how would you implement the server backed order by and filter operations? Order by on the grid data source is not the solution as it sorts the keys (guid!) and not the values. Is there any standard solution for that in the framework?
Best regards
Martin

Thank you for this clarification. In this regard I have another brain-teaser for you :
If you have a Grid with a Odata data source containing a column with a dropdown list, again with a remote data source : how would you implement the server backed order by and filter operations? Order by on the grid data source is not the solution as it sorts the keys (guid!) and not the values. Is there any standard solution for that in the framework ?
Best regards
Martin
Would it possible to share a bit more information, which will help us to get a better understanding of the case? Do you need to sort and filter the data in the ODATA service? Is the question is related to the Grid or to the DropDownList widget? What is the structure of the data that you want to manupulate?
Regards,
Georgi Krustev
Telerik