FilteringSelect problem with XmlStore

View: New views
4 Messages — Rating Filter:   Alert me  

FilteringSelect problem with XmlStore

by hai_vu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi all I am fairly new to Dojo 1.0+ so this may be an old issue, however here is a problem that I am trying to overcome. I have been trying to use a FilteringSelect widget with an XML data source without much luck. The problem ultimately boils down to this error reported by Firebug:

this.store.fetchItemByIdentity is not a function
(no name)("", null)dojo.js (line 129)
(no name)()dojo.js (line 233)
toString("postCreate", [], undefined)dojo.js (line 20)
(no name)()dojo.js (line 102)
toString("postCreate", [], undefined)dojo.js (line 20)
(no name)()dojo.js (line 212)
(no name)(Object store=Object autoComplete=true name=profile, input#profileSelect)dojo.js (line 165)
(no name)(Object store=Object autoComplete=true name=profile, input#profileSelect)dojo.js (line 78)
toString([Object store=Object autoComplete=true name=profile, input#profileSelect])dojo.js (line 20)
toString()dojo.js (line 20)
(no name)(input#profileSelect)dojo.js (line 204)
toString([div, input#profileSelect, input, 2 more...], function(), undefined)dojo.js (line 20)
(no name)([div, input#profileSelect, input, 2 more...])dojo.js (line 146)
(no name)(undefined)dojo.js (line 245)
(no name)()dojo.js (line 256)
toString()dojo.js (line 20)
toString()dojo.js (line 20)
toString()dojo.js (line 20)
toString(load )

Here is some background info on the environment where this was observed.

- Dojo version: 1.0.2
- Server-side: Tomcat 6
- Browsers: Firefox 2 & IE7
- Used examples in Book of Dojo 1.0

Code excerpt:

        index.jsp:
                ...
                <script type="text/javascript">
                        dojo.require("dojo.parser");
                        dojo.require("dojox.data.XmlStore");
                        dojo.require("dijit.form.FilteringSelect");
                        dojo.require("dijit.form.Button");
                </script>
                ...
                 <div dojoType="dojox.data.XmlStore" jsId="profileStore" rootItem="Profile" url="test.xml"></div>
                ...
                <form name="profileForm" method="post">
                 <input dojoType="dijit.form.FilteringSelect" id="profileSelect" name="profile" store="profileStore" autocomplete="true"/>
                </form>
                ...

        test.xml:
                <?xml version="1.0" encoding="windows-1252"?>

                <Profiles>
                        <Profile name="a" id="a" value="A" label="A"/>
                        <Profile name="b" id="b" value="B" label="B"/>
                </Profiles>

It looked as though Dojo encountered the error while attempting to access the data store code, no request to acquire the XML data was observed being sent to the server.

Thanks for any help,

Hai Vu
_______________________________________________
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

Re: FilteringSelect problem with XmlStore

by jaredj :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

   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,
-- Jared Jurkiewicz



On Jan 4, 2008 2:13 PM,  <hai_vu@...> wrote:

>
> Hi all I am fairly new to Dojo 1.0+ so this may be an old issue, however
> here is a problem that I am trying to overcome. I have been trying to use a
> FilteringSelect widget with an XML data source without much luck. The
> problem ultimately boils down to this error reported by Firebug:
>
> this.store.fetchItemByIdentity is not a function
> (no name)("", null)dojo.js (line 129)
> (no name)()dojo.js (line 233)
> toString("postCreate", [], undefined)dojo.js (line 20)
> (no name)()dojo.js (line 102)
> toString("postCreate", [], undefined)dojo.js (line 20)
> (no name)()dojo.js (line 212)
> (no name)(Object store=Object autoComplete=true name=profile,
> input#profileSelect)dojo.js (line 165)
> (no name)(Object store=Object autoComplete=true name=profile,
> input#profileSelect)dojo.js (line 78)
> toString([Object store=Object autoComplete=true name=profile,
> input#profileSelect])dojo.js (line 20)
> toString()dojo.js (line 20)
> (no name)(input#profileSelect)dojo.js (line 204)
> toString([div, input#profileSelect, input, 2 more...], function(),
> undefined)dojo.js (line 20)
> (no name)([div, input#profileSelect, input, 2 more...])dojo.js (line 146)
> (no name)(undefined)dojo.js (line 245)
> (no name)()dojo.js (line 256)
> toString()dojo.js (line 20)
> toString()dojo.js (line 20)
> toString()dojo.js (line 20)
> toString(load )
>
> Here is some background info on the environment where this was observed.
>
> - Dojo version: 1.0.2
> - Server-side: Tomcat 6
> - Browsers: Firefox 2 & IE7
> - Used examples in Book of Dojo 1.0
>
> Code excerpt:
>
>         index.jsp:
>                 ...
>                 <script type="text/javascript">
>                         dojo.require("dojo.parser");
>                         dojo.require("dojox.data.XmlStore");
>                         dojo.require("dijit.form.FilteringSelect");
>                         dojo.require("dijit.form.Button");
>                 </script>
>                 ...
>                  <div dojoType="dojox.data.XmlStore" jsId="profileStore"
> rootItem="Profile" url="test.xml"></div>
>                 ...
>                 <form name="profileForm" method="post">
>                  <input dojoType="dijit.form.FilteringSelect"
> id="profileSelect" name="profile" store="profileStore" autocomplete="true"/>
>                 </form>
>                 ...
>
>         test.xml:
>                 <?xml version="1.0" encoding="windows-1252"?>
>
>                 <Profiles>
>                         <Profile name="a" id="a" value="A" label="A"/>
>                         <Profile name="b" id="b" value="B" label="B"/>
>                 </Profiles>
>
> It looked as though Dojo encountered the error while attempting to access
> the data store code, no request to acquire the XML data was observed being
> sent to the server.
>
> Thanks for any help,
>
> Hai Vu
> _______________________________________________
> 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
>
>
_______________________________________________
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

Re: FilteringSelect problem with XmlStore

by hai_vu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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?

Hai Vu


"Jared Jurkiewicz" <jared.jurkiewicz@...>
Sent by: dojo-interest-bounces@...

01/04/2008 03:34 PM
Please respond to
dojo-interest@...

To
dojo-interest@...
cc
Subject
Re: [Dojo-interest] FilteringSelect problem with XmlStore





   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,
-- Jared Jurkiewicz



On Jan 4, 2008 2:13 PM,  <hai_vu@...> wrote:
>
> Hi all I am fairly new to Dojo 1.0+ so this may be an old issue, however
> here is a problem that I am trying to overcome. I have been trying to use a
> FilteringSelect widget with an XML data source without much luck. The
> problem ultimately boils down to this error reported by Firebug:
>
> this.store.fetchItemByIdentity is not a function
> (no name)("", null)dojo.js (line 129)
> (no name)()dojo.js (line 233)
> toString("postCreate", [], undefined)dojo.js (line 20)
> (no name)()dojo.js (line 102)
> toString("postCreate", [], undefined)dojo.js (line 20)
> (no name)()dojo.js (line 212)
> (no name)(Object store=Object autoComplete=true name=profile,
> input#profileSelect)dojo.js (line 165)
> (no name)(Object store=Object autoComplete=true name=profile,
> input#profileSelect)dojo.js (line 78)
> toString([Object store=Object autoComplete=true name=profile,
> input#profileSelect])dojo.js (line 20)
> toString()dojo.js (line 20)
> (no name)(input#profileSelect)dojo.js (line 204)
> toString([div, input#profileSelect, input, 2 more...], function(),
> undefined)dojo.js (line 20)
> (no name)([div, input#profileSelect, input, 2 more...])dojo.js (line 146)
> (no name)(undefined)dojo.js (line 245)
> (no name)()dojo.js (line 256)
> toString()dojo.js (line 20)
> toString()dojo.js (line 20)
> toString()dojo.js (line 20)
> toString(load )
>
> Here is some background info on the environment where this was observed.
>
> - Dojo version: 1.0.2
> - Server-side: Tomcat 6
> - Browsers: Firefox 2 & IE7
> - Used examples in Book of Dojo 1.0
>
> Code excerpt:
>
>         index.jsp:
>                 ...
>                 <script type="text/javascript">
>                         dojo.require("dojo.parser");
>                         dojo.require("dojox.data.XmlStore");
>                         dojo.require("dijit.form.FilteringSelect");
>                         dojo.require("dijit.form.Button");
>                 </script>
>                 ...
>                  <div dojoType="dojox.data.XmlStore" jsId="profileStore"
> rootItem="Profile" url="test.xml"></div>
>                 ...
>                 <form name="profileForm" method="post">
>                  <input dojoType="dijit.form.FilteringSelect"
> id="profileSelect" name="profile" store="profileStore" autocomplete="true"/>
>                 </form>
>                 ...
>
>         test.xml:
>                 <?xml version="1.0" encoding="windows-1252"?>
>
>                 <Profiles>
>                         <Profile name="a" id="a" value="A" label="A"/>
>                         <Profile name="b" id="b" value="B" label="B"/>
>                 </Profiles>
>
> It looked as though Dojo encountered the error while attempting to access
> the data store code, no request to acquire the XML data was observed being
> sent to the server.
>
> Thanks for any help,
>
> Hai Vu
> _______________________________________________
> 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
>
>
_______________________________________________
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


_______________________________________________
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

Re: FilteringSelect problem with XmlStore

by Craig_Riecke :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 <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