如何自定义Kendo React Scheduler?

时间:2019-07-10 12:17:02

标签: javascript reactjs kendo-ui scheduler

我正在我的应用程序中实现kendo react调度程序。我需要在调度程序对话框中添加一些额外的字段,并跟踪对话框控件的事件并实现一些后端逻辑。我陷入了困境。无法做到这一点。请帮帮我。

谢谢!

这是我的react js代码。

constructor(props) {
        super(props);

        var self = this;

        this.startTime = new Date("2013/6/13 07:00 AM")
        this.resources = [
            {
                field: "ownerId",
                title: "Owner",
                dataSource: [
                    { text: "Alex", value: 1, color: "#f8a398" },
                    { text: "Bob", value: 2, color: "#51a0ed" },
                    { text: "Charlie", value: 3, color: "#56ca85" }
                ]
            }
        ]
        this.views = [
            "day",
            { type: "workWeek", selected: true },
            "week",
            "month",
            "agenda",
            { type: "timeline", eventHeight: 50 }
        ]
        this.views = [{ type: "workWeek", selected: true }]
        this.dataSource = {
            batch: true,
            transport: {
                read: {
                    url: "https://demos.telerik.com/kendo-ui/service/tasks",
                    dataType: "jsonp"
                },
                update: {
                    url: "https://demos.telerik.com/kendo-ui/service/tasks/update",
                    dataType: "jsonp"
                },
                create: {
                    url: "https://demos.telerik.com/kendo-ui/service/tasks/create",
                    dataType: "jsonp"
                },
                destroy: {
                    url: "https://demos.telerik.com/kendo-ui/service/tasks/destroy",
                    dataType: "jsonp"
                },
                parameterMap: function (options, operation) {
                    debugger
                    if (operation !== "read" && options.models) {
                        var json = JSON.stringify(options.models);

                        self.workSpace.createNewItem(options.models[0]).then((responseJson) => {
                            debugger
                        })
                        return { models: JSON.stringify(options.models) };
                    }
                }
            },
            eventTemplate: $("#event-template").html(),
            schema: {
                model: {
                    id: "taskId",
                    fields: {
                        taskId: { from: "TaskID", type: "number" },
                        title: { from: "Title", defaultValue: "No title", validation: { required: true } },
                        phoneNumber: { from: "phoneNumber", type: "number", validation: { required: true } },
                        start: { type: "date", from: "Start" },
                        end: { type: "date", from: "End" },
                        startTimezone: { from: "StartTimezone" },
                        endTimezone: { from: "EndTimezone" },
                        description: { from: "Description" },
                        recurrenceId: { from: "RecurrenceID" },
                        recurrenceRule: { from: "RecurrenceRule" },
                        recurrenceException: { from: "RecurrenceException" },
                        ownerId: { from: "OwnerID", defaultValue: 1 },
                        isAllDay: { type: "boolean", from: "IsAllDay" }
                    }
                }
            },
            filter: {
                logic: "or",
                filters: [
                    { field: "ownerId", operator: "eq", value: 1 },
                    { field: "ownerId", operator: "eq", value: 2 }
                ]
            }
        }
    }



    render() {

        return (
            <div className="container-fluid">

                <div className="row col-lg-12 col-md-12 col-sm-12 col-xs-12">

                    <div>
                        <Scheduler height={600}
                            change={this.onChange}
                            views={this.views}
                            dataSource={this.dataSource}
                            date={new Date()}
                            startTime={this.startTime}
                            resources={this.resources} />
                    </div>



                </div>

            </div>

        );
    }

0 个答案:

没有答案