Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用Dhtmlxscheduler开发Windows 8应用程序_Javascript_Windows_Scheduler_Dhtml_Indexeddb - Fatal编程技术网

Javascript 使用Dhtmlxscheduler开发Windows 8应用程序

Javascript 使用Dhtmlxscheduler开发Windows 8应用程序,javascript,windows,scheduler,dhtml,indexeddb,Javascript,Windows,Scheduler,Dhtml,Indexeddb,我正在编写一个基于DHTMLxScheduler的通知应用程序 我想知道更多关于IndexedDB为DHTMLX调度器提供CRUD的想法 据我所知,下面的网站展示了一个很好的例子 但是,数据存储不是持久的,应用程序在多点触控事件期间会冻结 是否有人可以使用以下命令,通过CRUD的默认IndexedDB来帮助指导CRUD所需的编码 scheduler.attachEvent("onEventDeleted", function(event_id,event_

我正在编写一个基于DHTMLxScheduler的通知应用程序

我想知道更多关于IndexedDB为DHTMLX调度器提供CRUD的想法

据我所知,下面的网站展示了一个很好的例子

但是,数据存储不是持久的,应用程序在多点触控事件期间会冻结

是否有人可以使用以下命令,通过CRUD的默认IndexedDB来帮助指导CRUD所需的编码

    scheduler.attachEvent("onEventDeleted", 
              function(event_id,event_object){
    //add event to the data store
}); 

scheduler.attachEvent("onEventChanged", function(event_id, event_object){
    //update event in the data store 
}); 


scheduler.attachEvent("onEventAdded", function(event_id, event_object){
    //delete event from the data store 
});    
下面的示例演示如何通过IndexedDB进行集成

但是,它们共享不同的框架,而原始调度程序示例始终使用回调来检测更改


非常感谢你的帮助

IndexedDB需要相对大量的CRUD操作代码,所以本教程经过了认真的简化,以避免在实现细节方面使其过载。 还有一个完整的CRUD工作示例,请检查此软件包的“/samples/CalendarApp/”文件夹:

至于多点触摸问题,最有可能在最近的时间内解决。该软件包的当前版本基于dhtmlxScheduler3.7,我们将把它更新到4.0,它对基于windows的触摸设备进行了改进

这里是一个数据库处理的示例,类似于dhtmlx站点的应用程序中的处理方式

//connect to indexedDb and fire the callback on success
function connect(callback){
    try{
        var db = null;

        var req = window.indexedDB.open("SchedulerApp", 1);
        req.onsuccess = function (ev) {
            db = ev.target.result;
            if(callback)//fire a callback on connect
                callback(db);
        }

        req.onupgradeneeded = function(e){
            //The event is fired when connecting to the new database, or on version change.
            //This is the only place for defining database structure(object stores)
            var db = ev.target.result;

            if (!db.objectStoreNames.contains("events")) {
                //create datastore, set 'id' as autoincremental key
                var events = db.createObjectStore("events", { keyPath: "id", autoIncrement: true });
            }
        }
    }catch(e){
    }
}


//add js object to the database and fire callback on success
function insertEvent(data, callback) {
    connect(function (db) {
        var store = db.transaction("events", "readwrite").objectStore("events");
        var updated = store.add(data);
        updated.onsuccess = function (res) {
            callback(res.target.result);
        }
    });
}


// use all defined above with the dhtmlxScheduler
// when user adds an event into the scheduler - it will be saved to the database
scheduler.attachEvent("onEventAdded", function (id) {
    var ev = copyEvent(scheduler.getEvent(id));//where copyEvent is a helper function for deep copying
    delete ev.id;//real id will be assigned by the database

    insertEvent(ev, function (newId) {
        scheduler.changeEventId(id, newId);//update event id in the app
    });
    return true;
});
然而,我不能保证它会立即工作,我现在不能测试代码。 我还建议你检查一下这些文章

仅供参考,我在DHTMLX工作