vis.js在onAdd,onUpdate,onMove或onRemove中更改其他项目

时间:2017-07-29 16:32:21

标签: vis.js redraw

当我使用onAddonUpdateonMove更改另一个项目(B)时,我将更改时间轴中项目(A)的内容或onRemove。因为我需要在更改项目(B)后调用回调函数,所以我不知道如何更改项目(A)的内容并在不加载新整个时间轴的情况下显示它。

有可能吗?

由于

    onUpdate: function(item, callback) {
    entry = item;
    if (entry.editable) {

        // open dialog Window, #editOK is a button in this dialog window

        $("#editOK").unbind("click").click(function () {

            // allocation of data for saving in mysql

        .....
            dtf = moment($("#editFrom").jqxDateTimeInput('value')).format("YYYY-MM-DD HH:mm");
        .....

            saveDatas = $.param({ type: "U", .... });

            item.start = dtf;
            item.end = dtt;
            item.content = moment(dtf).format("HH:mm") + " - " + moment(dtt).format("HH:mm");
            item.codeDesc = des;
            item.pause = pau;
            item.idST = ist;

            editOrDel(saveDatas);
            // save of datas in mysql(actual item)

            // some things for other item

            saveDatas = $.param({ type: "A", ..... });

            editOrDel(saveDatas);
                        // save of other item(s)
            entry.id = aid;
            entry.group = group;
            entry.start = ....;

            times.push(entry);

            //  redraw the whole visjs schedule, I try it also without redraw and with the lines after the callback
            createCalendar("");

            // this callback was also after first editOrDel

            callback(item);

            timeline.setItems(null);
            timeline.setItems(times);
            timeline.redraw();
        });
    }
    else
        callback(null);
),

0 个答案:

没有答案