Telerik Forums
Kendo UI for jQuery Forum
2 answers
220 views
Hi Everyone,

I have following very simple code that works as expected.

        $(document).ready(function () {
 
            var ds = null;
 
            ds = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: "data.json", dataType: "json"
                    }
                },
                change: function () {
                    var data = this.data(); // or this.view();
                }
 
            });
 
 
            $("#grid").kendoGrid({
 
                dataSource: ds,
 
//                      dataSource: {
//                          data: ds,
//                          pageSize: 2
//                      },
 
                sortable: {
                    mode: "single",
                    allowUnsort: false
                },
 
                columns: [
                    {
                        field: "Product",
                        title: "Product Title"
                    },
                    {
                        field: "Manufacturer",
                        title: "Manufacturer Title"
                    },
                    {
                        field: "Description",
                        title: "Description Title"
                    },
                    {
                        field: "Property2",
                        title: "Property 2"
                    }
                ]
            });
 
 
        });
Why do I not need to call ds.read() in this scenario?

And 

If i replace the dataSource: ds with the commented block dataSource: {data: ds } no data is displayed at all. Any idea why?

Thanks for the help.
Umer
Top achievements
Rank 1
 answered on 17 Apr 2013
5 answers
90 views
Hi guys,
         Im currently having a project using a splitview..but Im having a difficult problem with the splitview. Because I want the split view hide first and call it in a button..Im paste the codes of splitview in a Page or View container but Its doesnt work. Can you help me guys.Thanks
Alexander Valchev
Telerik team
 answered on 17 Apr 2013
1 answer
158 views
How do I put an external  template into a grid column declaratively?

Here is what I am trying:
<script id="template" type='text/x-kendo-template'>
    #=Amount#
</script>
 
<div id="calledAndDefeasedDebt"
     data-role="grid"
     data-scrollable="false"
     data-bind="source: calledAndDefeasedDebt"
     data-columns="['Description', {'field':'Amount', 'title':'AMT', 'template':'kendo.template($(\'template\').html())'}]">
</div>
Nikolay Rusev
Telerik team
 answered on 17 Apr 2013
1 answer
78 views
I have
kendoGrid({
        dataSource : {
            transport : {
                read : "http://testsite/rest/receipts/_list_last/10.xml",
                create : {
                    url : "http://testsite/rest/receipts.xml",
                    dataType : "xml",
                    type : "POST",
                    contentType : "text/xml",
                    processData : false,
                    batch : false
                },
                parameterMap : function(data, type) {
                    if (type === "create") {
                        var postxml = '<reciept><id></id><tenant>';
                        postxml += data.tenant;
                        postxml += '</tenant>';
                        return postxml;
                    }
                }
            }

When I hit "add new record", every record in the grid including the new one is sent to the server.
Is there a way to prevent this and only allow the newly added record to get POST'ed to the server?
Kind Regards
Andrew
Daniel
Telerik team
 answered on 17 Apr 2013
3 answers
469 views
Dear Kendo Team,
I try to run a tooltip (see code below and result in attachment).
var tooltip = $("#Button_Settings_ID").kendoTooltip({
        filter: "input",
        width: 210,
        height: heigth,
        position: "bottom",
        autoHide: false,
        showOn: "click",
        callout: true,
        content: kendo.template($("#Button_Settings_template").html())
    }).data("kendoTooltip");

This works fine, excepted I can see the call out...
I force the value to true, but without succes...
I take your example, provided here, and I've got the same result....(see in attachment)
<head>
    <title></title>
    <link href="Content/kendo/2013.1.319/kendo.default.min.css" rel="stylesheet" type="text/css" />
    <link href="Content/kendo/2013.1.319/kendo.common.min.css" rel="stylesheet" type="text/css" />
    <script src="Script/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script src="Script/kendo/2013.1.319/kendo.all.min.js" type="text/javascript"></script>
</head>
<body>
            <div id="example" class="k-content">
            <div class="demo-section">
                <div id="agglomerations">
                    <a href="#" title="Canton - 26,300,000" id="canton"></a>
                    <a href="#" title="Jakarta - 25,800,000" id="jakarta"></a>
                    <a href="#" title="Mexico City - 23,500,000" id="mexico"></a>
                    <a href="#" title="Delhi - 23,500,000" id="delhi"></a>
                    <a href="#" title="Karachi - 22,100,000" id="karachi"></a>
                    <a href="#" title="New York - 21,500,000" id="newyork"></a>
                    <a href="#" title="Sao Paulo - 21,300,000" id="saopaolo"></a>
                    <a href="#" title="Mumbay/Bombay - 21,100,000" id="bombay"></a>
                    <a href="#" title="Los Angeles - 17,100,000" id="losangeles"></a>
                    <a href="#" title="Osaka - 16,800,000" id="osaka"></a>
                    <a href="#" title="Moscow - 16,200,000" id="moscow"></a>
                </div>
            </div>
 
            <script>
                $(document).ready(function () {
                    var tooltip = $("#agglomerations").kendoTooltip({
                        filter: "a",
                        width: 120,
 
                        position: "top"
                    }).data("kendoTooltip");
 
                    tooltip.show($("#canton"));
 
                    $("#agglomerations").find("a").click(false);
                });
            </script>
 
            <style scoped="scoped">
 
                .demo-section {
                    width: 692px;
                }
 
                #agglomerations {
                    position: relative;
                    width: 692px;
                    height: 480px;
                    margin: 0 auto;
                    background: url('../../content/web/tooltip/world-map.jpg') no-repeat 0 0;
                }
 
                #agglomerations a {
                    position: absolute;
                    display: block;
                    width: 12px;
                    height: 12px;
                    background-color: #fff600;
                    -moz-border-radius: 30px;
                    -webkit-border-radius: 30px;
                    border-radius: 30px;
                    border: 0;
                    -moz-box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
                    -webkit-box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
                    box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
                    -moz-transition:  -moz-box-shadow .3s;
                    -webkit-transition:  -webkit-box-shadow .3s;
                    transition:  box-shadow .3s;
                }
 
                #agglomerations a:hover {
                    -moz-box-shadow: 0 0 0 15px rgba(0,0,0,0.5);
                    -webkit-box-shadow: 0 0 0 15px rgba(0,0,0,0.5);
                    box-shadow: 0 0 0 15px rgba(0,0,0,0.5);
                    -moz-transition:  -moz-box-shadow .3s;
                    -webkit-transition:  -webkit-box-shadow .3s;
                    transition:  box-shadow .3s;
                }
 
                #canton { top: 226px; left: 501px; }
                #jakarta { top: 266px; left: 494px; }
                #mexico { top: 227px; left: 182px; }
                #delhi { top: 214px; left: 448px; }
                #karachi { top: 222px; left: 431px; }
                #newyork { top: 188px; left: 214px; }
                #saopaolo { top: 304px; left: 248px; }
                #bombay { top: 233px; left: 438px; }
                #losangeles { top: 202px; left: 148px; }
                #osaka { top: 201px; left: 535px; }
                #moscow { top: 153px; left: 402px; }
 
                #canton:hover,
                #jakarta:hover,
                #mexico:hover,
                #delhi:hover,
                #karachi:hover,
                #newyork:hover,
                #saopaolo:hover,
                #bombay:hover,
                #losangeles:hover,
                #osaka:hover,
                #moscow:hover { z-index: 10; }
 
            </style>
        </div>
 
 
</body>
</html>

The only things that i've changed, it's the jquery path (currently using jquery-1.8.3.min.js)
Thanks for your help!
Best regards
Dimo
Telerik team
 answered on 17 Apr 2013
2 answers
397 views
I am absolutely new to Kenod and all it attached features and needed tasks - so please forgive me.

I was able to retrieve data from my sql database and bind it to a tabstrip.

var dsBuecherAT = new kendo.data.DataSource(
                    {
                    transport: {
                            read: {
                            url: "/api/t_buechers",
                            dataType: "json"
                        }
                        }
                });
                 
                $("#buecherAT").kendoTabStrip({
                    dataTextField: "Buch",
                    dataContentField: "Buch_ID",
                    dataSource: dsBuecherAT
                });
However when I try to filter (remember I am actually clueless what I am doing) its not working.

1)  http://docs.kendoui.com/api/framework/datasource the syntax looks like

var dataSource = new kendo.data.DataSource({
  data: [
    { name: "Jane Doe" },
    { name: "John Doe" }
  ],
  filter: { field: "name", operator: "startswith", value: "Jane" }
});
If I search the web I mostly find fiields operator and value in""

Does it matter?
Which is correct?

var dataSource = new kendo.data.DataSource({
  data: [
    { name: "Jane Doe" },
    { name: "John Doe" }
  ],
  filter: { "field": "name", "operator:" "startswith", "value:" "Jane" }
});

2) this are two ways I tried and both did not work. Any suggestions?

Try # 1

//we are getting the kapitels
               function getKapitels(buch_ID) {
                   alert(buch_ID);
                   var dsKapitels = new kendo.data.DataSource({
                       transport: {
                           read: {
                               url: "/api/t_kapitels",
                               dataType: "json"
                           }
                       }
 
                   });
 
                   $("#kapitel").kendoTabStrip({
                
                       dataTextField: "Kapitel_ID",
                       dataContentField: "Buch_ID",
                       dataSource: dsKapitels.filter({ field: "Buch_ID", operator: "eq", value: "1" })
                   })
               }
Try #2

 
//we are getting the kapitels
               function getKapitels(buch_ID) {
                   alert(buch_ID);
                   var dsKapitels = new kendo.data.DataSource({
                       transport: {
                           read: {
                               url: "/api/t_kapitels",
                               dataType: "json"
                           }
                       },
                         
                      filter: { field: "Buch_ID", operator: "eq", value: "1" }
 
                   });
 
                   $("#kapitel").kendoTabStrip({
                
                       dataTextField: "Kapitel_ID",
                       dataContentField: "Buch_ID",
                       dataSource: dsKapitels
                   })
               }

Any help is appreciated, and please forgive me if these questions are to clear.

Markus
Markus
Top achievements
Rank 2
 answered on 16 Apr 2013
1 answer
194 views
I searched around for a while in the forums, etc. but wasn't able to find an answer, so my apologies if this has already been addressed elsewhere.

I'm using a DataViz pie chart and would like to have the option for labels to show outside the pie or on the pie slices themselves.  I can accomplish this by setting series.labels.position to outsideEnd for outside the chart and centered to render them on the pie slices.

However, if there are pie slices that are too small (let's say %5 of the pie or less) having the labels render on the pie slice is not very useful, and I'd like to have them render outsider the pie.  In other words, it would be nice if there were an option to tell the chart to render the label on the slice except in cases where the slice is too small, in which case the label will automatically render outside the slice.  This sort of behavior seems pretty standard in other pie charts I've seen in the past.

Is there a way to easily do this? 

Thanks!
--Joel
Iliana Dyankova
Telerik team
 answered on 16 Apr 2013
1 answer
194 views
I am running Chrome version 26.0.1410.60M. In this version of my browser, from within the grid I cannot seem to modify and change the check boxes. When I click on the true or false within grid, it does change the OptOut field from true or false to a checkbox. But then when I try to update the checkbox, the grid doesn't let me, and it just toggles back to True or false. Here is the HTML from the page. Is there something I'm doing wrong on the page, or is this an issue with the kendo libraries?

Attached is the cshtml file that generated the code, and the final HTML.
Thanks!

File1:
@model Pipeline.Web.Models.EmailPreferencesViewModel@{
    ViewBag.Title = "title";
  //  Layout = "About.cshtml";
}<h2>title</h2>
<script>
    $(document).ready(function() {
    //    window.emailTemplateGrid = @Html.Raw(Json.Encode(Model.emailTemplateSelectionsViewModel));        var dataSource = new kendo.data.DataSource({
            data: @Html.Raw(Json.Encode(Model.emailTemplateSelectionsViewModel)),
            schema: {
                model: {
                    id: "ID",
                    fields: {
                        ID: { type: "number" },
                        NotificationName: { type: "string" },
                        Description: { type: "string" },
                        OptOut: { type: "boolean",editable:true }
                    }
                }
            },
            pageSize: 20                
        });                //var dataSource = new kendo.data.DataSource({
        //    data: [
        //     { ID:1,NotificationName:"test1",Description: "Test Desc",OptOut:true },
        //     { ID:2,NotificationName:"test2",Description: "Test Desc2",OptOut: false}
           
           
        //    ]
               
        //        ,
        //    schema: {
        //        model: {
        //            id:"ID",
        //            fields: {
        //                ID: { type: "number" },
        //                NotificationName: { type: "string" },
        //                Description: { type: "string" },
        //                OptOut: { type: "boolean" }
        //            }
        //        }
        //    },
        //    pageSize: 20
                           
        //});          console.log("Client Contact Grid Data: " + JSON.stringify(dataSource, null, 4));
        var grid = $("#emailTemplateGrid").kendoGrid({
           
            dataSource:dataSource,
            pageable:true,
            columns: [
                { title: "ID", field: "ID", hidden: true },
                { title: "Notification Name", field: "NotificationName" },
                { title: "Description", field: "Description" },
                { field: "OptOut", title: "OptOut", width:210}],
                       
            editable: true
          
        });    
        //{ command: ["edit", "destroy"], title: "&nbsp;", width: "172px" }        $("#btnSave").click(function() {
         //   var notes = $("#ATPNotes").data("kendoEditor").value();
            var emailTemplate = [];
            $.each(dataSource._data, function (index, value) {
               
                var emailTemplateSelectionsViewModel = { };
                emailTemplateSelectionsViewModel.ID = value.ID;
                emailTemplateSelectionsViewModel.NotificationName = value.NotificationName;
                emailTemplateSelectionsViewModel.Description = value.Description;
                emailTemplateSelectionsViewModel.OptOut = value.OptOut;
               
               
                emailTemplate.push(emailTemplateSelectionsViewModel);
                console.log("emailTemplateSelectionsViewModel: " + JSON.stringify(emailTemplateSelectionsViewModel, null, 4));
            });
         //   var searchTeam = [];
         //   $.each(window.searchTeamGridData, function(index, value) {
         //       searchTeam.push(value.ID);
         //   });       
                        var DTO = { 'emailTemplateSelectionsViewModels': emailTemplate };     $.ajax({
         type: 'POST',
         url: "@Url.Action("EmailPreferencesUpdate", "DataService")",
                contentType: 'application/json;charset=utf-8',
                data: JSON.stringify(DTO),
                dataType: 'json'
            //    success: function(data) {
            //        $("#ATPhoneCall").data("kendoWindow").close();
            //        location.reload(true);
           //     }
            });
 });
    });
</script>
<div id="emailTemplateGrid"></div>
<BR /><strong>Regional Approvers:</strong><br/>
    <div id="searchTeam"><!-- Filled from jquery load call --></div>
<br/> <input id="btnSave" type="button" value="Save" />
    

Final HTML:
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>title - Pipeline</title>
        <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <meta name="viewport" content="width=device-width" />
        <link href="/Content/Site.css" rel="stylesheet"/>
<link href="/Content/Main.css" rel="stylesheet"/>        <link href="/Content/Kendo/kendo.common.css" rel="stylesheet"/>
<link href="/Content/Kendo/kendo.default.css" rel="stylesheet"/>
        <script src="/Scripts/Lib/jquery-1.9.1.js"></script>        <script src="/Scripts/Kendo/kendo.web-2013.1.319.js"></script>
<script src="/Scripts/Kendo/kendo.aspnetmvc-2013.1.319.js"></script>        <script src="/Scripts/Lib/modernizr-2.5.3.js"></script>        <script src="/Scripts/pipeline.dataservice.js"></script>        <script src="/Scripts/pipeline.utilities.js"></script>    </head>
    <body>
        <header>
            <div class="content-wrapper">
                <div class="float-left">
                    <p class="site-title"><a href="/">your logo here</a></p>
                </div>
                <div class="float-right">
                    <section id="login">
                        Hello, <span class="username">CTNET\adm_kkess</span>!
                    </section>
                    <nav>
                        <ul id="menu">
                            <li><a href="/">Home</a></li>
                            <li><a href="/Admin">Admin</a></li>
                            <li><a href="/Home/About">About</a></li>
                            <li><a href="/Home/Contact">Contact</a></li>
                        </ul>
                    </nav>
                </div>
            </div>
        </header>
        <div id="body">
           
            <section class="content-wrapper main-content clear-fix">
                <h2>title</h2>
<script>
    $(document).ready(function() {
    //    window.emailTemplateGrid = [{"ID":3,"NotificationName":"1OnListToGet","Description":"Another to send","OptOut":false},{"ID":4,"NotificationName":"2LOETestEveryoneCanOptOut","Description":"LOE Test Email Avail to everyone and can opt out","OptOut":true}];        var dataSource = new kendo.data.DataSource({
            data: [{"ID":3,"NotificationName":"1OnListToGet","Description":"Another to send","OptOut":false},{"ID":4,"NotificationName":"2LOETestEveryoneCanOptOut","Description":"LOE Test Email Avail to everyone and can opt out","OptOut":true}],
            schema: {
                model: {
                    id: "ID",
                    fields: {
                        ID: { type: "number" },
                        NotificationName: { type: "string" },
                        Description: { type: "string" },
                        OptOut: { type: "boolean",editable:true }
                    }
                }
            },
            pageSize: 20                
        });                //var dataSource = new kendo.data.DataSource({
        //    data: [
        //     { ID:1,NotificationName:"test1",Description: "Test Desc",OptOut:true },
        //     { ID:2,NotificationName:"test2",Description: "Test Desc2",OptOut: false}
           
           
        //    ]
               
        //        ,
        //    schema: {
        //        model: {
        //            id:"ID",
        //            fields: {
        //                ID: { type: "number" },
        //                NotificationName: { type: "string" },
        //                Description: { type: "string" },
        //                OptOut: { type: "boolean" }
        //            }
        //        }
        //    },
        //    pageSize: 20
                           
        //});          console.log("Client Contact Grid Data: " + JSON.stringify(dataSource, null, 4));
        var grid = $("#emailTemplateGrid").kendoGrid({
           
            dataSource:dataSource,
            pageable:true,
            columns: [
                { title: "ID", field: "ID", hidden: true },
                { title: "Notification Name", field: "NotificationName" },
                { title: "Description", field: "Description" },
                { field: "OptOut", title: "OptOut", width:210}],
                       
            editable: true
          
        });    
        //{ command: ["edit", "destroy"], title: "&nbsp;", width: "172px" }        $("#btnSave").click(function() {
         //   var notes = $("#ATPNotes").data("kendoEditor").value();
            var emailTemplate = [];
            $.each(dataSource._data, function (index, value) {
               
                var emailTemplateSelectionsViewModel = { };
                emailTemplateSelectionsViewModel.ID = value.ID;
                emailTemplateSelectionsViewModel.NotificationName = value.NotificationName;
                emailTemplateSelectionsViewModel.Description = value.Description;
                emailTemplateSelectionsViewModel.OptOut = value.OptOut;
               
               
                emailTemplate.push(emailTemplateSelectionsViewModel);
                console.log("emailTemplateSelectionsViewModel: " + JSON.stringify(emailTemplateSelectionsViewModel, null, 4));
            });
         //   var searchTeam = [];
         //   $.each(window.searchTeamGridData, function(index, value) {
         //       searchTeam.push(value.ID);
         //   });       
                        var DTO = { 'emailTemplateSelectionsViewModels': emailTemplate };     $.ajax({
         type: 'POST',
         url: "/DataService/EmailPreferencesUpdate",
                contentType: 'application/json;charset=utf-8',
                data: JSON.stringify(DTO),
                dataType: 'json'
            //    success: function(data) {
            //        $("#ATPhoneCall").data("kendoWindow").close();
            //        location.reload(true);
           //     }
            });
 });
    });
</script>
<div id="emailTemplateGrid"></div>
<BR /><strong>Regional Approvers:</strong><br/>
    <div id="searchTeam"><!-- Filled from jquery load call --></div>
<br/> <input id="btnSave" type="button" value="Save" />
   
       
            </section>
        </div>
        <footer>
            <div class="content-wrapper">
                <div class="float-left">
                    <p>&copy; 2013 - My ASP.NET MVC Application</p>
                </div>
            </div>
        </footer>     </body>
</html>
         

Vladimir Iliev
Telerik team
 answered on 16 Apr 2013
1 answer
147 views
I want to know about the event of 'series chart click event and plot area click'.

I gave a click event to series chart and plot area chart , but the problem is "I don't know the 'ID' of clicked chart'

How can I get the 'Id' of chart that I clicked??

Thanks in advance.
Iliana Dyankova
Telerik team
 answered on 16 Apr 2013
1 answer
123 views
I'm trying to use the Kendo UI colour picker with the opacity slider, which the documentation describes as being available if you use the hsv selector. 

If I use the hsv selector and change the RGB values first, all select events fire normally. However if I try and change the opacity first using the opacity slider, the select event doesn't fire, and therefore the colour doesn't update to reflect the new opacity value. If I change the rgb colour values at any stage, the select event then fires normally from then on.

So basically there seems to be an issue if the user only wishes to change the opacity of particular colour, but does not need to change the RGB values for the colour. 

Can anyone confirm whether this is a bug?  It is happening in IE9 and Chrome for me, Kendo UI Q1 2013 release.  
Dimiter Madjarov
Telerik team
 answered on 16 Apr 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?