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

Datasource called everytime I bind a dropdown list to it

1 Answer 181 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Shane P
Top achievements
Rank 1
Shane P asked on 20 May 2012, 03:10 AM
I have a kendo grid setup with its own datasource and within the databound event I am binding a dropdownlist to its own datasource.

The grid binds ok and the dropdown is populate ok however when I look in the network console I am seeing that the datasource is calling my service everytime a dropdown list is added.

How can I set this up to only call the service the single time as I don't want to be making extra calls to my api 

var dataSource = new kendo.data.DataSource({
    transport: {
        read: {
            url: "/API/store/get",
            dataType: "json",
            data: function () {
                return {
                    businessId: $("#BusinessId").val()
                };
            }
        }
    }
});
var data = new kendo.data.DataSource({
    transport: {
        read: {
            url: "getoutlets",
            dataType: "json",
            data: function () {
                return {
                    businessId: $("#BusinessId").val()
                };
            }
 
        }
    }
});
 
$(document).ready(function () {
    $("#outlets").kendoGrid({
        sortable: true,
        dataSource: data,
        dataBound: function (e) {
            $(".dropdown").kendoDropDownList({
                dataTextField: "StoreName",
                dataValueField: "StoreId",
                dataSource: dataSource
            });
            
            console.log(e);
        },
        columns: [
            {
                field: "name",
                title: "Name (Supplier)"
            },
            {
                title: "Name",
                template: "<input class='dropdown' id\='#=id #' value\='#=MappedStoreId #'></input>"
            }
        ,
            {
                title: "",
                template: '<a href="\\#" class="green-button small" data-id\="#=id #">Update</a>',
                width: "110px"
 
            }
        ]
    //                rowTemplate: kendo.template($("#rowTemplate").html())
    });

1 Answer, 1 is accepted

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

 
I have answered to the other thread opened on the same matter. I will suggest you open a support ticket next time. Thus the support team will be able to investigate the issue faster.

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
Data Source
Asked by
Shane P
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or