[dojo-contributors] Q about dojo.data update notification

Brian Douglas Skinner skinner at dojotoolkit.org
Thu Aug 9 15:08:33 EDT 2007

ItemFileWriteStore implements the Notification API, if you want to try 
it out.

If using topics would be more natural for the code you're writing, I 
think it would be very easy to add a thin layer of code that just 
connects to the notification functions and then publishes topic messages 
when they are called.

:o) Brian

Jared Jurkiewicz wrote:
> Notification API is complete.  I don't know why Bill thinks it is 
> half-complete.   It's documented in dojo/data/api/Notification, as well 
> as out on the Dojotoolkit book:
> http://www.dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/what-dojo-data/dojo-data-design-and-apis/notif
> It doesn't use topics. There was a large amount of discussion on this
>  and it was agreed with Alex to keep it super simple (decided months 
> ago). There are functions on the store you can connect to, to get 
> events on changes. This is no more work than asking a store for a 
> topic, then listening to a topic in the amount of code it would take 
> (It's probably less).
> And remember, not all stores implement every 'API' set. Some stores
> may not choose to implement Notification, just like some stores may
> not choose to implement write.
> -- Jared
> On 8/9/07, *Tom Trenka* <ttrenka at gmail.com <mailto:ttrenka at gmail.com>> 
> wrote:
>     Hey guys,
>     I was just talking with Bill and I'm wondering what the current plan
>     is for a dojo.data.store to notify anything consuming it that
>     updates have been made?  It seems to me that the ideal situation
>     would be to use topics, something on the order of (assuming multiple
>     dijits are using the same store for data):
>     1.  new [dijit]: if gets data from a store, ask the store what the
>     update topic to subscribe to is.
>     2.  dijit subscribes to said topic.
>     3.  all data changes are made to the underlying store as opposed to
>     any kind of internal rep used by a dijit
>     4.  when changes are pushed into a store, the store publishes the
>     topic message
>     5.  dijits built to re-render/update representation when
>     subscriptions get the message.
>     Bill mentioned that there's some kind of notification API in the
>     works (or half done), but wasn't sure if this is the way it
>     worked--hence the question.  I did something very similar to this
>     with collections.Store /FilteringTable, and (aside from some bugs
>     with updates as opposed to inserts) it worked very well (it used
>     connect instead of topics, but otherwise that was the structure).
>     Am I off with this, and if so would someone mind explaining either
>     how it actually works (or what the game plan is)?
>     trt
>     _______________________________________________
>     dojo-contributors mailing list
>     dojo-contributors at dojotoolkit.org
>     <mailto:dojo-contributors at dojotoolkit.org>
>     http://dojotoolkit.org/mailman/listinfo/dojo-contributors
> ------------------------------------------------------------------------
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-contributors

More information about the dojo-contributors mailing list