Telerik Forums
Kendo UI for jQuery Forum
1 answer
242 views

Hello,
I have pivot grid control and I'm trying to display several charts according to this pivot.
when the data is expanded the charts present correct data but when I start collapsing the columns the data in the charts starts freaking out and some of the data is missing and the other one is incorrect or displaying duplicated values.
I have tried the solutions proposed in the following thread:  but seems like it still doesn't work. 
any idea?
Please see the code below. 

functionloadPivotWWvsBoard() {
    $("#divPivot").html("");
    $("#divConfigurator").html("");
    var collapsed = {
        columns: [],
        rows: []
    };
    /*define the data source*/var DataSource;
 
    jQuery.ajaxSetup({
        async: false
    });
 
    $.get("/Report/GetDeliveredReportJSON", { fromWW: $("#FromWW").val(), toWW: $("#ToWW").val() }).done(function (data) {
        DataSource = data;
    })
 
    var dataSource = new kendo.data.PivotDataSource({
        data: DataSource
        , type: "xmla"
        , schema: {
            model: {
                fields: {
                    "Project": {
                        type: "string"
                    }
                    , Board: {
                        type: "string"
                    }
                    , WW: {
                        type: "string"
                    }
                    , "ApproveDate": {
                        field: "ApproveDate"
                        , type: "date"
                    }
                    , ReceiverName: {
                        field: "ReceiverName"
                    }
                    , RequestorName: {
                        field: "RequestorName"
                    }
                    , ApprovingManager: {
                        field: "ApprovingManager"
                    }
                    , PartTrans: {
                        field: "PartTrans"
                    }
                    , SerialNumber: {
                        field: "SerialNumber"
                    }
                    , OpeningDate: {
                        field: "OpeningDate"
                    }
                    , DeliveredDate: {
                        field: "DeliveredDate"
                    }
                    , ApprovalType: {
                        field: "ApprovalType"
                    }
                    , DateDifference: {
                        field: "DateDifference"
                    }
                    , ReportType: {
                        field: "ReportType"
                    }
                    , BusinessLine: {
                        field: "BusinessLine"
                    }
                    , Branch: {
                        field: "Branch"
                    }
                    , ManagerType: {
                        field: "ManagerType"
                    }
                    , CostCenter: {
                        field: "CostCenter"
                    }
                    , SapOrder: {
                        field: "SapOrder"
                    }
                ,
                }
            }
            , cube: {
                dimensions: {
                    "Project": {
                        caption: "Project"
                    }
                    , Board: {
                        caption: "Board"
                    }
                    , WW: {
                        caption: "WW"
                    }
                    , "ApproveDate": {
                        caption: "Approve Date"
                    }
                }
                , measures: {
                    "Delivered Quantity": {
                        field: "SerialNumber"
                        , aggregate: "count"
                    }
                }
            }
        }
        , columns: [{
            name: "Project", expand: true
        },
        {
            name: "Board", expand: true
        }]
        , rows: [{
            name: "WW"
        }]
        , measures: ["Delivered Quantity"]
    });
 
    dataSource.filter(loadFiltersForGrid(false))
    dataSource.fetch(function () {
        console.log("data source created successfuly", dataSource);
    });
 
    /*define the pivot*/var pivotgrid = $("#divPivot")
        .kendoPivotGrid({
            filterable: true,
            sortable: true,
            collapseMember: function (e) {
                var axis = collapsed[e.axis];
                var path = e.path[0];
 
                if (axis.indexOf(path) === -1) {
                    axis.push(path);
                }
            },
            expandMember: function (e) {
                var axis = collapsed[e.axis];
                var index = axis.indexOf(e.path[0]);
 
                if (index !== -1) {
                    axis.splice(index, 1);
                }
            },
            dataSource: dataSource
            , dataBound: function () {
                this.dataSource.expandColumn(["Project", "Board"]);
                this.dataSource.expandColumn(["Project"]);
                this.dataSource.expandRow(["WW"]);
                // this.dataSource.filter(filters);
                initChart(convertData(this.dataSource, collapsed, "Project"));
                initChart2(convertData(this.dataSource, collapsed, "Board"));
            }
        })
        .data("kendoPivotGrid");
 
 
    /*define the chart*/functioninitChart(data) {
 
        $("#divChart1").kendoChart({
            dataSource: {
                data: data,
                group: "column"
            },
            title: {
                text: "Delivered quantity by project"
            },
            legend: {
                position: "top"
            },
            seriesDefaults: {
                type: "bar"
            },
            series: [{
                type: "column",
                field: "measure",
            }],
            categoryAxis: {
                field: "row"
                , padding: {
                    top: 135
                }
                 , majorGridLines: {
                     visible: true
                 }
            },
            valueAxis: {
               majorGridLines: {
                    visible: true
                }
            },
            tooltip: {
                visible: true,
                format: "{0}",
                template: "#= series.name #: #= value #"
            },
            dataBound: function (e) {
                // e.sender.options.categoryAxis.categories.sort()
            }
        });
    }
    functioninitChart2(data) {
 
        $("#divChart2").kendoChart({
            dataSource: {
                data: data,
                group: "column"
            },
            title: {
                text: "Delivered quantity by board"
            },
            legend: {
                position: "top"
            },
            seriesDefaults: {
                type: "bar"
            },
            series: [{
                type: "column",
                field: "measure",
            }],
            categoryAxis: {
                field: "row"
                , padding: {
                    top: 135
                }
                 , majorGridLines: {
                     visible: true
                 }
            },
            valueAxis: {
                 majorGridLines: {
                    visible: true
                }
            },
            tooltip: {
                visible: true,
                format: "{0}",
                template: "#= series.name #: #= value #"
            },
            dataBound: function (e) {
                // e.sender.options.categoryAxis.categories.sort()
            }
        });
    }
}
 
functionflattenTree(tuples) {
    tuples = tuples.slice();
    var result = [];
    var tuple = tuples.shift();
    var idx, length, spliceIndex, children, member;
 
    while (tuple) {
        //required for multiple measuresif (tuple.dataIndex !== undefined) {
            result.push(tuple);
        }
 
        spliceIndex = 0;
        for (idx = 0, length = tuple.members.length; idx < length; idx++) {
            member = tuple.members[idx];
            children = member.children;
            if (member.measure) {
                [].splice.apply(tuples, [0, 0].concat(children));
            } else {
                [].splice.apply(tuples, [spliceIndex, 0].concat(children));
            }
            spliceIndex += children.length;
        }
 
        tuple = tuples.shift();
    }
 
    return result;
}
 
functionisCollapsed(tuple, collapsed) {
    var name = tuple.members[0].parentName;
 
    for (var idx = 0, length = collapsed.length; idx < length; idx++) {
        if (collapsed[idx] === name) {
            console.log(name);
            returntrue;
        }
    }
 
    returnfalse;
}
 
functionconvertData(dataSource, collapsed, type) {
    var columnTuples = flattenTree(dataSource.axes().columns.tuples || [], collapsed.columns);
    var rowTuples = flattenTree(dataSource.axes().rows.tuples || [], collapsed.rows);
    var data = dataSource.data();
    var rowTuple, columnTuple;
 
    var idx = 0;
    var result = [];
    var columnsLength = columnTuples.length;
 
    for (var i = 0; i < rowTuples.length; i++) {
        rowTuple = rowTuples[i];
 
        if (!isCollapsed(rowTuple, collapsed.rows)) {
            for (var j = 0; j < columnsLength; j++) {
                columnTuple = columnTuples[j];
 
                if (!isCollapsed(columnTuple, collapsed.columns)) {
                    if (idx > columnsLength && idx % columnsLength !== 0) {
 
                        var memebrtype;
                        if (type == "Board") {
                            memebrtype = 1
                        } else {
                            memebrtype = 0
                        }
                        var columninfo =  GetChildren(columnTuple.members[memebrtype], type);
                        if (columninfo) {
                            result.push({
                                measure: Number(data[idx].value),
                                column: columninfo,
                                row: rowTuple.members[0].caption
                            });
                        }
                       
                    }
                }
                idx += 1;
            }
        }
    }
 
    return result;
}
 
 
functionGetChildren(parent, type) {
    var result = undefined;
 
    if (parent.hasChildren || result != undefined) {
        for (var i = 0; i < parent.children.length; i++) {
            result = GetChildren(parent.children[i], type);
        }
    } else {
        result = parent.caption;
    }
    if (result == type) {
        result = undefined;
    }
 
 
    return result;
}

 

Tsvetina
Telerik team
 answered on 23 Mar 2017
1 answer
663 views

Hi all

I am trying to load some remote data (web api) to combobox at fiddler i can see that the data return but the widget does not showing anything.

 

var dataSource = new kendo.data.DataSource({
                transport: {
                        read: {
                            dataType: "jsonp",
                            url: `My URL`,
                            data: {
                                name: "product"
                            }
                        }
                    }
            });
            $("#crmAttributes").kendoComboBox({
                dataTextField: "DisplayName",
                dataValueField: "Myvalue",
                dataSource: dataSource.read()
            }).data("kendoComboBox").open();

 

I am working on rtl...

 

thanks for your help :)

Nikolay
Telerik team
 answered on 23 Mar 2017
6 answers
724 views

We have a lot of Kendo grids with boolean columns in our application - but in ALL of them, we have suddenly found that this column won't update on editing (see attached images before and after clicking on the row's update button).

 

This is a high priority issue for us!

Dimiter Topalov
Telerik team
 answered on 23 Mar 2017
4 answers
265 views
Hi,

I'm creating this new post from http://www.kendoui.com/forums.aspx/kendo-ui-web/scheduler/extending-agenda-view-to-show-whole-month-or-above-.aspx

Since I'm using the razor part I would like to know how to initialize the widget correctly. I've tried to put it together with the snippets from the above post but I cannot get it to work. Perhaps I'm missing something. Does anyone know how to do this properly?

This is what I have and it's not working:
<script type="text/javascript">
 
    var CustomAgenda = kendo.ui.AgendaView.extend({
        endDate: function () {
            var date = kendo.ui.AgendaView.fn.endDate.call(this);
            return kendo.date.addDays(date, 30);
        }
    });
    kendo.ui.Scheduler.fn.options.views = [{ type: "CustomAgenda", title: "My View" }];
 
</script>
 
@(Html.Kendo().Scheduler<Gusto.Web.Models.Scheduler.TaskViewModel>()
    .Name("scheduler")

Rosen
Telerik team
 answered on 23 Mar 2017
1 answer
98 views

Hi,

I am currently working on a sample , where a user can drag and drop shapes from a panel to diagram.I can find a shape using bounds() , when user drops on it.

But i couldn't do the same for a connection.

My intention is just to find a connection from diagram and modify it..(When user drag and drop a new shape on a particular connection)

Find the sample which i am working on now

http://dojo.telerik.com/IHuzA/7

Please update how to find a connection, when user drops a shape on it ?

 

Konstantin Dikov
Telerik team
 answered on 23 Mar 2017
2 answers
137 views

Hello.  How can I access the progressStatus field when using MVVM?  Dojo: http://dojo.telerik.com/uzawo.

Thank you.  

John
Top achievements
Rank 1
 answered on 22 Mar 2017
2 answers
182 views

Hi,

 

i have problems with a json-based create method. Read is called and everything is displayed fine. But adding items does not trigger the create url. I tried adding new items wit id=0 or null or completely empty. But it is not working? What do I miss?

<script id="noDataTemplate" type="text/x-kendo-tmpl"> <div> No data found. Do you want to add new item - '#: instance.input.val() #' ? </div> <br /> <button class="k-button" onclick="addNew('#: instance.element[0].id #', '#: instance.input.val() #')">Add new item</button> </script><script> function addNew(widgetId, value) { var widget = $("#" + widgetId).getKendoMultiSelect(); var dataSource = widget.dataSource; dataSource.add({ name : value }); dataSource.sync(); } </script><script> $(document) .ready( function() { $("#title").kendoDropDownList(); $("#sex").kendoDropDownList(); var dataSource = new kendo.data.DataSource( { batch: true, transport : { read : { url : "http://XXX/tags?objectType=user", dataType : "json" }, create : { url : "http://XXX/tag/createForUser", dataType : "json", type: "POST" }, parameterMap : function(data, type) { if (type !== "read") { // send the created data items as the "models" service parameter encoded in JSON return { models : kendo .stringify(data.models) }; } } }, schema: { model: { id: "id", fields: { name: { type: "string" } } } } }); $("#tags").kendoMultiSelect( { filter : "startswith", dataTextField : "name", dataValueField : "id", dataSource : dataSource, noDataTemplate : $( "#noDataTemplate").html() }); /* $("#tags") .data("kendoMultiSelect") .value( /*[]*/ //[]); }); </script>

Ivan Danchev
Telerik team
 answered on 22 Mar 2017
1 answer
144 views

We recently encountered an interesting problem with the Scheduler. 

Our current usage of the Scheduler has a month and day view. We currently support three statues per day for items scheduled i.e. (Booked, Open, Canceled). We would like to sort by Day the status in the following order, (Booked, Open, Canceled). So a sort was implemented at the database level to return the collection with each day's scheduled items in the order listed above. 

 

The results in Chrome are not correct in the Month view when looking at a week at a time days which should have scheduled items sorted are not sorted as described above. However if you select just the Day View the scheduled items are sorted correctly. What makes the issue even more interesting is that if the same control is rendered in IE everything displays properly. 

We have tried sorting at the client side and server side and each time the datasource is sorted properly but then renders improperly. 

 

I did some further research on this issue and found the following forum posts:

http://www.telerik.com/forums/datasource-sort()-behavior-inconsistent-across-browsers

http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/sorting/stable-sort-chrome

 

Is there any work around to get the sorting results within the scheduler to sort properly in Chrome? 

Misho
Telerik team
 answered on 22 Mar 2017
1 answer
137 views

Hi,

I'm trying to make a indoor map viewer by using Kendo UI Map. The only problem is that the map is a single image and cannot be split into tiles. Is there any way to use a single non-tiled image for the map?

T. Tsonev
Telerik team
 answered on 22 Mar 2017
2 answers
326 views

I have an issue with a theme I generated using the current ThemeBuilder tool at http://demos.telerik.com/kendo-ui/themebuilder/ .  Here is what I did (please let me know if I did something wrong, as I did have to figure some steps out; the documentation is not as complete as I would have hoped). 

  1. I went to the ThemeBuilder site and generated a theme.  I started with the Default theme, and customized from there.  However, the problem happens even when making no changes to the Default theme.  You can load that up, and just hit "Download Theme" . 
  2. After downloading the "kendo.custom.zip" file, I extracted it to a subfolder. 
  3. I renamed the files so that instead of "kendo.custom.css" it was "kendo.xyz.css" (where xyz was the name I wanted).  This step is obviously not required to see the problem, but I just wanted to mention it.
  4. I am only using the .css file; we don't use LESS nor DataViz, so I assume we don't need those files at all.  Is this an incorrect assumption?  Do we need to do something with those files on top of the .css file? 
  5. I copied the "templates" folder from kendo into my project, as well as all of the images from "Default" folder, into my own "xyz" folder. 
  6. Upon opening the .css file in an editor, I noticed all the "background-image" properties were "url('none/sprite.png')" (or similar).  I mass-replaced these with the proper folder name ("xyz/sprite.png").  I also ensured all the "template" folder references were correct.  (This is one step that could use better documentation, instead of leaving to the user to figure out that his urls in the CSS don't work). 
  7. In my HTML file, I referenced the following css files, in this order:
    1. kendo.common.min.js - from my installed kendo folder (which is version 2017.1.118).
    2. kendo.xyz.css - my custom theme
  8. Upon loading a normal grid, I noticed that every place in the grid where an icon should be, the proper icon shows up overlaid on top of what looks like the up-arrow ".k-I-arrow-60-up".  So all the icons appear messed up because of this. 
  9. What's worse, for my custom theme, I wanted some of my icons to be white instead of dark grey.  I copied over the sprite.png file from the "Black" theme, gave it a new name, and had some of my icons reference that one instead.  What happened then was that the ".k-I-arrow-60-up" icon turned white, while the actual correct icon for the button remained dark grey. 
  10. I tried debugging this from within all three browsers' F12 menus, but none of them seem to see the "other" background property.  The one they do see seems to be the incorrect up-arrow one; if I disable that css, that one goes away, so I seem to have no way to reference the other one or fix it.  It's like it's hard-coded into the grid, and somehow it is hidden even from the browsers' dev tools. 

Please follow those steps and see if you see the same issue.  I would attach my files, but it would require all the folders and copies of the image files, and you already have all that.  It's easier for you to just follow the steps and then you can verify the process on your end. 

Thank you,

Chris

Stefan
Telerik team
 answered on 22 Mar 2017
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
DatePicker
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Application
Map
Drag and Drop
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
Filter
SPA
Drawing API
Drawer (Mobile)
Globalization
LinearGauge
Sortable
ModalView
Hierarchical Data Source
Button
FileManager
MaskedTextBox
View
Form
NavBar
Notification
Switch (Mobile)
SplitView
ListBox
DropDownTree
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
ColorPicker
Pager
Styling
MultiColumnComboBox
Chat
DateRangePicker
Dialog
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Effects
Accessibility
PivotGridV2
ScrollView
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Breadcrumb
Collapsible
Localization
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
TimePicker
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
StockChart
ContextMenu
DateTimePicker
RadialGauge
ArcGauge
AICodingAssistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?