Telerik Forums
Kendo UI for jQuery Forum
1 answer
249 views

Hi, 

I tried to create a pie chart. I did my own filtering from controller. So far I am not having any script errors but my chart is not displaying at all. When I put a break point on script I can see the data is coming correctly as array. Couldn't figure out why it is not displaying.

So far my data response is as follow;

{"Data":[{"AisStateType":"Under Way Using Engine","TotalDistance":9806.0141499469737,"DistancePercentage":100.0,"TotalTime":1536.0666666666666,"TimePercentage":100.0,"Id":1,"Form":null,"CustomProperties":{}},{"AisStateType":"At Anchor","TotalDistance":0.0,"DistancePercentage":0.0,"TotalTime":0.0,"TimePercentage":0.0,"Id":2,"Form":null,"CustomProperties":{}},{"AisStateType":"Not Under Command","TotalDistance":0.0,"DistancePercentage":0.0,"TotalTime":0.0,"TimePercentage":0.0,"Id":3,"Form":null,"CustomProperties":{}},{"AisStateType":"Restricted Maneuverability","TotalDistance":0.0,"DistancePercentage":0.0,"TotalTime":0.0,"TimePercentage":0.0,"Id":4,"Form":null,"CustomProperties":{}},{"AisStateType":"Constrained by Her Draught","TotalDistance":0.0,"DistancePercentage":0.0,"TotalTime":0.0,"TimePercentage":0.0,"Id":5,"Form":null,"CustomProperties":{}},{"AisStateType":"Moored","TotalDistance":0.0,"DistancePercentage":0.0,"TotalTime":0.0,"TimePercentage":0.0,"Id":6,"Form":null,"CustomProperties":{}},{"AisStateType":"Aground","TotalDistance":0.0,"DistancePercentage":0.0,"TotalTime":0.0,"TimePercentage":0.0,"Id":7,"Form":null,"CustomProperties":{}},{"AisStateType":"Engaged in Fishing","TotalDistance":0.0,"DistancePercentage":0.0,"TotalTime":0.0,"TimePercentage":0.0,"Id":8,"Form":null,"CustomProperties":{}},{"AisStateType":"Under Way Sailing","TotalDistance":0.0,"DistancePercentage":0.0,"TotalTime":0.0,"TimePercentage":0.0,"Id":9,"Form":null,"CustomProperties":{}},{"AisStateType":"Reserved for future amendment of navigational status for ships carrying DG, HS, or MP, or IMO hazard or pollutant category C","TotalDistance":0.0,"DistancePercentage":0.0,"TotalTime":0.0,"TimePercentage":0.0,"Id":10,"Form":null,"CustomProperties":{}}],"Total":10,"ExtraData":null,"Errors":null,"Form":null,"CustomProperties":{}}

 

and my cshtml is;

<div id="piechart"></div>
        <script>
            function createChart() {
                $("#piechart").kendoChart({
                    dataSource: {
                        type: "json",
                        transport: {
                            read: {
                                url: "@Html.Raw(Url.Action("AisReportList", "AisTrackingAdmin"))",
                                type: "POST",
                                dataType: "json",
                                data: additionalData
                            }
                        },
                        schema: {
                            data: function (response) {
                                return response.Data; // twitter's response is { "statuses": [ /* results */ ] }
                            }
 
                        },
                        requestEnd: function (e) {
                            if (e.type == "update") {
                                this.read();
                            }
                        },
                        error: function (e) {
                            display_kendoui_chart_error(e);
                            // Cancel the changes
                            this.cancelChanges();
                        }
                    },
                    title: {
                        position: "bottom",
                        text: "Ais Data Report for @Model.ShipName, @Model.StartDate - @Model.EndDate"
                    },
                    legend: {
                        visible: false
                    },
                    chartArea: {
                        background: ""
                    },
                    seriesDefaults: {
                        labels: {
                            visible: true,
                            background: "transparent",
                            template: "#= AisStateType #: \n #= DistancePercentage#%"
                        }
                    },
                    series: [{
                        type: "pie",
                        startAngle: 150,
                        field: "AisStateType",
                        categoryField: "DistancePercentage"
                    }],
                    tooltip: {
                        visible: true,
                        format: "{0}%"
                    }
                });
            }
 
            $(document).ready(createChart);
            $(document).bind("kendo:skinChange", createChart);
        </script>
    </div>
 
<script>
        $(document).ready(function () {
            //search button
            $('#search-aisdata').click(function () {
                //search
                $("#piechart").data("kendoChart").dataSource.read();
                $("#piechart").data("kendoChart").redraw();
                return false;
            });
 
            $("#@Html.IdFor(model => model.AisReportSearchModel.SearchDestination)").keydown(function (event) {
                if (event.keyCode === 13) {
                    $("#search-aisdata").click();
                    return false;
                }
            });
 
        });
 
        function additionalData() {
            var data = {
                ShipId: $("#@Html.IdFor(model => model.AisReportSearchModel.ShipId) option:selected").val(),
                SearchDestination: $('#@Html.IdFor(model => model.AisReportSearchModel.SearchDestination)').val(),
                SearchStartDate: $('#@Html.IdFor(model => model.AisReportSearchModel.SearchStartDate)').val(),
                SearchEndDate: $('#@Html.IdFor(model => model.AisReportSearchModel.SearchEndDate)').val()
            };
            addAntiForgeryToken(data);
            return data;
        }
</script>

 

 

 

 

Bulut
Top achievements
Rank 1
 answered on 20 Sep 2018
10 answers
2.2K+ views

Hi everyone

 

I'm using Angular 2 kendo grid component and want to select/unselect grid row programmatically, from the code.

Is there any solution for this issue?

 

Thanks

Vladan

bhavin
Top achievements
Rank 1
 answered on 20 Sep 2018
3 answers
384 views

I have a kendo grid that was working before the following upgrade

2015 Q1 (2014.3.1411) ->  v2017.3.1026

Along with this, we also upgraded from angular1.2 to angular1.6

The grid has some columns like the following example. But after the upgrade the edit input does not show in the column.

If I add a breakpoint right after the appendTo I can see that the editor function actually gets fired, and the inputs is added to the DOM, but then it disapears, (I'm guessing after an angularjs digest cycle or something). If I dont add any breakpoint it happens so fast that it is impossible to notice that the input is actually added to the DOM for a millisecond only the disappear immediately.

What could have happened in the upgrade to break this... or any idea how to fix it?

Thanks

columns: [{
    field: "account",
    title: "accounts",
    editor: function (container, options){
         $('<input id="' + options.field + '" data-bind="value:' + options.field + '" class="form-control" ' + ' />')
             .appendTo(container);
    }
}, ...
Alex Hajigeorgieva
Telerik team
 answered on 20 Sep 2018
5 answers
559 views
Hello!
I've tried to put ToolTip into TreeView node. This is my note template:

<
script id="treeview-template" type="text/kendo-ui-template">
    <div style="width:500px">
        <span class="#: item.icon #" style="width:18px"></span>
        <span>#: item.name() #</span>
         # if (item.description() != null) { #
            <span class="ico-tooltip fa fa-info-circle" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="#: item.description() #" ></span>
         # } #
         <button type="button" class="btn btn-xs" style="height:16px;margin-left:5px">
             <i class="fa fa-lg fa-plus-square-o"></i>
         </button>             
    </div>
</script>

I also tried to use kendo-knockout library with code:
<i class="ico-tooltip fa fa-info-circle" data-bind="kendoTooltip: { content: item.description() }"></i>
but it didn't work too...


Is it any posibility to put working Tooltip on TreeView node?
Is posibility to connect button on TreeView node to knockout function?

Thanks for any help

Sreejith
Top achievements
Rank 1
 answered on 20 Sep 2018
3 answers
335 views

For some reason the default tooltip for the box plot chart formats the lower, q1, mean, median, q3, and upper fields as currency. I am not dealing with currency, how can I change the format of the data in the tooltip.

To view what I am talking about go to the demo page of the Box Plot Chart here: https://demos.telerik.com/kendo-ui/box-plot-charts/index

Notice that the chart is showing statistical information about temperature, but if you mouse over a box the tooltip formats the details as currency.

Tsvetina
Telerik team
 answered on 20 Sep 2018
6 answers
232 views
I have a strange issue while working with jquery kendo grid.Here is my schema :

                fields: {
                    id: "id",
                    shopID: {editable: false},
                    workStartHour: { type: "date"},
                    workEndHour: { type: "date" },
                }

Here are columns from my grid :

     {
                    field: "shopID"
                },
                {
    
                    field: "workStartHour",
                    editor: timePicker,
                    format: "{0:HH:mm}"
                },
                {
                    editor: timePicker,
                    field: "workEndHour",
                    format: "{0:HH:mm}"
                },
                { command: ["edit"], title: "&nbsp;" }

After I change startHour and click 'Update' my update method isn't called.
But when I set 
`editable : true`
for shopID then change it in my line, click update my update method is fired.

What may cause this ?

Here is my timepicker :

    var timePicker = function (container, options) {
        var input = $("<input/>");
        var value;
        var property;
        for (var key in options.model) {
            if (options.field.toString() == key.toString()) {
                value = options.model[key];
                property = key;
            }
        }
        input.attr(options.field, value);
        input.appendTo(container);
    
        input.kendoTimePicker({
            change: function () {
                value = this.value();
                options.model[property] = new Date(value);
            },
            value: value,
            format: "{0:HH:mm}",
            dateInput: true
        });
    }
Preslav
Telerik team
 answered on 20 Sep 2018
12 answers
3.2K+ views

Hello,

I have a grid with a column that has template to displays a label based on a key ( ie: "#= getLabel(key) #").  The issue is that the sorting for this column is incorrect since the column is being sorted by the key and not the label ( which the user sees).

I implemented a custom sort for the grid but now every column clicked goes thru my custom compare function.  I put this at the column item level in the columns array in the configuration.

Is it possible to have a custom compare for 1 column but not all ( ie: alphanumeric, date columns would go to default sorting)?

If only 1 sort function is allowed,  how can I tell what column is clicked in that 1 sort function?

Thanks,

Bruce Radtke

 

Preslav
Telerik team
 answered on 20 Sep 2018
1 answer
410 views

Hi,

I have a fixed set of rows in spreadsheet. Whenever a row is deleted from this spreadsheet, the next row in sequence is selected. 

But when I try to delete the last row of the spreadsheet, I want the previous row in sequence to be selected.

Is there a way to set a specific row as selected post deletion? 

 

Thanks

Kajal

Neli
Telerik team
 answered on 19 Sep 2018
1 answer
76 views

I user kendo js vession 2017.1.118 when I use iPad Pro - Smart Keyboard , when I type on textbox  it will show correct on word choice like pic.1,

but when I type on Editor it can't show the word choice like pic.2

Neli
Telerik team
 answered on 19 Sep 2018
2 answers
788 views

Hi,

Is it possible to wrap the content (basically just a long line of text) of a notification without using templates?

Regards,
Pieter

Lawrence
Top achievements
Rank 2
Iron
 answered on 19 Sep 2018
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?