5 Answers, 1 is accepted
0
Hi Daniel,
To accomplish this please use the dataSource's add method. Once the item is added the DropDownList will automatically refresh.
Regards,
Alexander Valchev
Telerik
To accomplish this please use the dataSource's add method. Once the item is added the DropDownList will automatically refresh.
Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Daniel
Top achievements
Rank 1
answered on 04 Nov 2013, 07:35 AM
kendo.data.dataSource is the source of a dropdownlist?
the ideea is that i added something using the serverside,the source has the new value,but the dropdown remains with the same elements.
and i used ajax on client side to call the fill for a dropdown.
the ideea is that i added something using the serverside,the source has the new value,but the dropdown remains with the same elements.
and i used ajax on client side to call the fill for a dropdown.
0
Hello Daniel,
The data of an Ajax bound DropDownList is stored in its DataSource (instance of kendo.data.DataSource). You should obtain a reference to the DataSource via jQuery:
Where dropDownListID is the ID of the DropDown element, text and value are respectively the dataTextField and the dataValueField of the widget.
In case you added a record in the data base and would like to fetch the new data from the server, you need to call the read method of the DataSource. Add method inserts new entry on the client.
Regards,
Alexander Valchev
Telerik
The data of an Ajax bound DropDownList is stored in its DataSource (instance of kendo.data.DataSource). You should obtain a reference to the DataSource via jQuery:
$(
"#dropDownListID"
).data(
"kendoDropDownList"
)
.dataSource.add({
"text"
:
"new Item"
,
"value"
: 1000});
Where dropDownListID is the ID of the DropDown element, text and value are respectively the dataTextField and the dataValueField of the widget.
In case you added a record in the data base and would like to fetch the new data from the server, you need to call the read method of the DataSource. Add method inserts new entry on the client.
Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Daniel
Top achievements
Rank 1
answered on 06 Nov 2013, 10:56 AM
the scenario is exactly the oposite.
I added a new item on server-side ,the source now it has its new item,and somehow i need to refresh the dropdownlist on the client,the .refresh or the .datasource.Read() does not do the trick.
or do you mean that what i still need is to call .Read() from the server? in that case how?
Regards,
Daniel
I added a new item on server-side ,the source now it has its new item,and somehow i need to refresh the dropdownlist on the client,the .refresh or the .datasource.Read() does not do the trick.
or do you mean that what i still need is to call .Read() from the server? in that case how?
Regards,
Daniel
0
Hi Daniel,
I mean that you should call dataSource.read() (starting with a small letter) on the client side. The method will trigger the read transport of the DataSource which will issue Ajax request to the server. When the new data is retrieved the DropDownList widget will refresh automatically.
In case you still have problems please provide the relevant code so we can check your current configuration.
Regards,
Alexander Valchev
Telerik
I mean that you should call dataSource.read() (starting with a small letter) on the client side. The method will trigger the read transport of the DataSource which will issue Ajax request to the server. When the new data is retrieved the DropDownList widget will refresh automatically.
In case you still have problems please provide the relevant code so we can check your current configuration.
Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!