In Dgrid 0.3.16 I was using an Observable store and when my data in the store was changed I called the store notify function. (not 'put' because I need only an UI update, this is a specific case)
store.notify(object, existingId);
I have now upgraded Dgrid to version 0.4 and I'm using 'dstore' as the store. The store is created like this:
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;
How do I notify the store when one row is changed without calling 'put'? I need dGrid to re-render the row.
dstore follows a model more similar to typical event-driven approaches with
on
andemit
methods. dstore supportsadd
,update
anddelete
events - the first two expect an object with atarget
property referencing the item; thedelete
event expects an object with anid
property referencing the item's identity.So to notify of an updated item, call
store.emit('update', { target: updatedItem })
.The
emit
method is documented under Store methods, and the types of events are further enumerated in the Collection documentation.