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

Setting the DataSourceSchema attribute of the datasource in a kendo combobox in Razor syntax

1 Answer 296 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
VasVas
Top achievements
Rank 1
VasVas asked on 19 May 2013, 01:16 PM
I am tring to synco a streets combo which is cascaded with a citys combo with it's value in the model.
I am tring to use the fallowing js lines:

var combobox = $("#MyStreetsCombo").data("kendoComboBox);
var dataItem = combox.dataSource.get(combobox.value());
combo.select(dataItem);

var dataItem is always undefined.

I have seen this post http://www.kendoui.com/forums/ui/dropdownlist/why-doesn-t-mydropdowncontrolid-data-kendodropdownlist-datasource-get-1-work.aspx
but I do not understand how to pass the jsonobject DataSourceSchema to set the id of the model in the rasor syntax.

@(Html.Kendo().ComboBox()
.Name("StreetsCombo")
.DataTextField("Text")
.DataValueField("Value")
.DataSource(source => {
                                     source.Read(read =>
                                        {
                                           readAction("Action" , "Controller")
                                           .Data("filterFunction");
                                          })
                                         .ServerFiltering(true)
                                         .DataSourceSchema( new  {model  ..... id = 'Value'}).???;


)

Ariel

1 Answer, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 22 May 2013, 06:27 AM
Hello Ariel,

 
The DataSource builder used by ComboBox allows to define only the read url. Currently, setting the DataSource scheme is not supported. If you need to get the selected data item then you can use the ComboBox's dataItem method. If still need to use get method of DataSource, then loop array returned by the data method and find the correct data item.

Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ComboBox
Asked by
VasVas
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or