Kendo UI: Runtime datasource updates

Q1. How to update the data parameter  inside the data source when calling read method at run time?
Ans:  This example is with grid control and dropdownlist. First is parameter name and the second will be actual value. The code marked in Red should be inside document.ready();"kendoGrid"){ Id: Id });"kendoDropDownList"){ type: type });  

 gridDataSource = new{  
     type: "json",  
     transport: {  
       read: {  
         url: crudServiceBaseUrl + "/GetCurrentUserGMap/",  
         contentType: "application/json; charset=utf-8",  
         dataType: "json",  
         type: "post",  
         data: { Id: Id }  
       parameterMap: function (options) {  
         return JSON.stringify(options);  
     batch: true,  
     pageSize: 30,  
     schema: {  
       model: {  
         id: "Id",  
         fields: {  
           UserName: { editable: false, nullable: false },  
           GroupName: { editable: false, nullable: false }  
 Mgrid= $("#grid").kendoGrid({  
     dataSource: gridDataSource,  
     height: 350,  
     pageable: true,  
     editable: false,  
     rowTemplate: kendo.template($("#rowTemplate").html())  
 function UpdateData() {  
         Id = OUEventArgunments.OuId.split('_')[1];  
         type = OUEventArgunments.OuTypeId;  "kendoGrid"){ Id: Id });  

Q2. How to set the default text to the dropdownlist  at run time?

 $("#dduser").val("").data("kendoDropDownList").text("--Choose User--");  

Published by Nirbhay

Technology Geek,Blogger,Reviewer

One thought on “Kendo UI: Runtime datasource updates

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

<span>%d</span> bloggers like this: