Telerik Forums
Kendo UI for jQuery Forum
2 answers
127 views

I'm using the AngularJS configuration options to set up a basic gantt chart for tasks and dependencies (see below for configuration) along with a Web API 2 web service. If I don't include configuration for dependencies, all functionality around tasks behaves exactly as expected. However, including dependencies seems to be causing some odd behaviors. Attempting to delete a dependency triggers a "create" operation within the dependency datasource instead of a "destroy". Deleting a task will also trigger the dependency "create" operation, while a "destroy" operation is still triggered as expected for the task. If I try to create a new dependency between tasks it appears that a "create" operation will be invoked not just for the new dependency, but for all other existing dependencies within the datasource. Is this expected behavior and I'm just not understanding something, or is there a problem that I'm not seeing in my configuration?

The script version I'm using is v2017.1.118.

<div kendo-gantt k-options="vm.ganttOptions"></div>

 

 

var rootUrl = "/api/requestTasks";
var datatype = "json";
var contenttype = "application/json";
var requestId = "1";
$scope.ganttDs = new kendo.data.GanttDataSource({
    batch: false,
    transport: {
        read: {
            url: rootUrl + "/" + requestId,
            dataType: datatype
        },
        update: {
            url: rootUrl,
            dataType: datatype,
            type: "PUT",
            contentType: contenttype
        },
        destroy: {
            url: rootUrl + "/delete",
            dataType: datatype,
            type: "POST",
            contentType: contenttype
        },
        create: {
            url: rootUrl,
            dataType: datatype,
            type: "POST",
            contentType: contenttype
        },
        parameterMap: (options, operation) =>
        {
            if (operation !== "read")
            {
                return kendo.stringify(options);
            }
        }
    },
    schema: {
        model: {
            id: "id",
            fields: {
                id: { from: "Id", type: "number" },
                orderId: { from: "Order", type: "number", validation: { required: true } },
                parentId: { from: "ParentId", type: "number", defaultValue: null, validation: { required: true } },
                start: { from: "StartDate", type: "date" },
                end: { from: "EndDate", type: "date" },
                title: { from: "Title", defaultValue: "new task", type: "string" },
                percentComplete: { from: "PercentComplete", type: "number" },
                summary: { from: "Summary", type: "boolean" },
                expanded: { from: "Expanded", type: "boolean" },

                requestId: { from: "RequstId", type: "number" }

            }
        }
    }
});
var depUrl = "api/requestTaskDependencies";
$scope.ganttDependencyDs = new kendo.data.GanttDependencyDataSource({
    transport: {
        read: {
            url: depUrl + "/" + requestId,
            dataType: datatype
        },
        update: {
            url: depUrl,
            dataType: datatype,
            type: "PUT",
            contentType: contenttype
        },
        create: {
            url: depUrl,
            dataType: datatype,
            type: "POST",
            contentType: contenttype
        },
        destroy: {
            url: depUrl + "/delete",
            dataType: datatype,
            type: "POST",
            contentType: contenttype
        },
        parameterMap: (options, operation) =>
        {
            if (operation !== "read")
            {
                return kendo.stringify(options);
            }
        }
    },
    schema: {
        model: {
            id: "id",
            fields: {
                predecessorId: {from: "PredecessorId", type: "number"},
                successorId: {from: "SuccessorId", type: "number"},
                type: {from: "Type", type: "number"}
            }
        }
    }
});
$scope.ganttOptions = {
    dataSource: ganttDs,
    dependencies: ganttDependencyDs,
    height: 500,
    views: [
        {type: "day", selected: true},
        "week",
        "month"
    ],
    columns: [
        { field: "title", title: "Title", editable: true },
        { field: "start", title: "Start Date", format: "{0:MM/dd/yyyy}", width: 100 },
        { field: "end", title: "End Date", format: "{0:MM/dd/yyyy}", width: 100 }
    ]
};
Andrew
Top achievements
Rank 1
 answered on 23 Mar 2017
1 answer
100 views
Hi,

I am using Kendo UI grid (via JavaScript/Typescript) and would need to allow users to open an Grid Item in the edit popup (or similar popup) with a permalink, i.e. https://somesite/GridTest?id=1234 should open item with id 1234 in a popup window and display the corresponding fields of it.

The grid itself may contain many items and the specific item might not be on the first page.

I am using server side filtering, sorting and paging.

Or is there any other option to display an item with a direct link?
Stefan
Telerik team
 answered on 23 Mar 2017
1 answer
44 views
Why when calling Model.set the row selection gets cleared?
Dimiter Topalov
Telerik team
 answered on 23 Mar 2017
2 answers
959 views

Hi,

I have a requirement where user can enter numbers with decimals with max length of 10 and the decimal point can occur anywhere within the input. Sample input can be like 1223.4588, 123456.78, 012.45, 678 etc

Can i use the rules option of the maskedtextbox to achieve this. I guess the only option would be to use a regex pattern but it doesn't seem to work. We tried below and also k-mask="'00000.0000'" but none seem to work

$("#id").kendoMaskedTextBox({
   mask: "{{^(?!0\d|\.|.*?\..*?\.)(?=(?:\.?\d){1,10}$)(.*)$}}"
}); 

For requirement above will the numerictextbox serve the purpose ?

Ratno
Top achievements
Rank 1
 answered on 23 Mar 2017
1 answer
232 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
656 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
709 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
246 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
93 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
128 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
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?