« Return to Thread: FilteringSelect problem with XmlStore

Re: FilteringSelect problem with XmlStore

by Craig_Riecke :: Rate this Message:

Reply to Author | View in Thread

 <hai_vu <at> Mitel.com> writes:

>
>
> Is this something that would eventually
> be supported by the XML store or is this a design decision? Either way
> perhaps this limitation should be mentioned in the documentation.
> So which store type support the Identity
> interface?

Yes, that definitely should be mentioned, and I'll add it when I have a moment.

In the meantime, you can either use ItemFileReadStore, or you can "roll your
own" Identity patch for your own XML Store.  This works for me using Tree - am
not sure about FilteringSelect.   Then you just substitute "dojox.data.XmlStore"
with "MyXmlStore" wherever you want.  Note: this only works for XmlStores that
get fetch completely in one request.

dojo.provide("MyXmlStore");

dojo.require("dojox.data.XmlStore");

dojo.declare("MyXmlStore",
    dojox.data.XmlStore,  {
        // This new store adds Identity
        getFeatures: function(){
            return {
                'dojo.data.api.Read': true,
                'dojo.data.api.Identity': true
            };
        },
       
        // Identity value for top level nodes
        getIdentity: function (item) {
           return this.getValue(item, "orderNumber");
        },
       
        // Array of attribute names making up id
        getIdentityAttributes: function(item) {
           return [ "orderNumber" ];
        },
       
        fetchItemByIdentity: function(keywordArgs) {
           /* This API is not needed for Tree */
           console.error("FetchItemByIdentity unimplemented");
        }
    }
);

>
>
>
>    dojox.data.XmlStore doesn't implement
> the dojo.data.api.Identity
> interface.   It only implements dojo.data.api.Read and
> dojo.data.api.Write.   FilteringSelect requires that the store
> provided implement the identity interface, and apparently doesn't
> properly test the store for features and report a useful error should
> the store provided not implement an interface the widget wants.
> Sincerely,




_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://dojotoolkit.org/docs/book
Forums: http://dojotoolkit.org/forum
Dojo-interest@...
http://dojotoolkit.org/mailman/listinfo/dojo-interest

 « Return to Thread: FilteringSelect problem with XmlStore