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

Adding a dropdown list to a table causing datasource to call webservice multiple times

1 Answer 149 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Shane P
Top achievements
Rank 1
Shane P asked on 16 May 2012, 10:23 PM
I am using mvc to generate my table then I am apply the kendo grid to the table.

In one of the grid cells I am using a kendo dropdownlist. I am having a couple of problems. My script look likes

$(document).ready(function () {
           var dataSource = new kendo.data.DataSource({
               transport: {
                   read: {
                       url: "/API/store/get",
                       dataType: "json",
                       data: function () {
                           return {
                               businessId: $("#BusinessId").val()
                           };
                       }
                   }
               }
           });
           $("#outlets").kendoGrid({ sortable: true });
           $(".dropdown").kendoDropDownList({
               dataTextField: "StoreName",
               dataValueField: "StoreId",
               optionLabel: "Select...",
               dataSource: dataSource
           });


Problem 1. The datasource is calling my webservice for every dropdown list bound to it. Is it possible to only have the service called once?

Problem 2. the optionLabel value is only applied to 1st dropdownlist and no others. Is this a bug or something wrong with the way I have configured it?

Thank you!

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 22 May 2012, 09:44 AM
Hello Shane,

 
Straight upto your questions:

#1:
I was not able to reproduce the described problem. Check this screencast. The datasource can make more than one request if the read/fetch method is called numerious times before the data is loaded. If you need to ensure only one request I will suggest you bind the DropDownList widgets in the change event of the shared dataSource.

#2:
As it is shown in the screencast I was not able observe the depicted issue.

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