Dgrid 0.4和dstore:更新UI中的行而不放置请求

Fer*_*urg 1 dojo dgrid dstore

在Dgrid 0.3.16我使用的是Observable商店,当我在商店中的数据发生变化时,我调用了商店通知功能.(不是'put',因为我只需要一个UI更新,这是一个特定的情况)

store.notify(object, existingId);
Run Code Online (Sandbox Code Playgroud)

我现在已将Dgrid升级到版本0.4,我使用'dstore'作为商店.商店是这样创建的:

        var store = new declare([ Rest, SimpleQuery, Trackable, Cache, TreeStore ])(lang.mixin({
            target:"/ac/api?fetchview",
            idProperty:"$uniqueid", 
            useRangeHeaders: true
        }, config));

        store.getRootCollection = function (parent, options) {
            return this.root.filter({parent: parent.$position},options);
        };

        store.getChildren = function (parent, options) {
            return this.root.filter({parent: parent.$position},options);
        };

        store.mayHaveChildren = function (item) {
            return item.$iscategory;
        };

        this.collection = store;
Run Code Online (Sandbox Code Playgroud)

如何更改一行而不调用"put"时如何通知商店?我需要dGrid重新渲染行.

Ken*_*iro 5

dstore遵循的模型更类似于典型的事件驱动方法onemit方法.dstore支持add,update以及delete事件-前两个期望有一个对象target属性引用的项目; 该delete事件需要一个具有id引用该项标识的属性的对象.

因此,要通知更新的项目,请致电store.emit('update', { target: updatedItem }).

emit方法记录在Store方法下,并且在Collection文档中进一步枚举了事件类型.