Opened 10 years ago

Closed 10 years ago

#9185 closed defect (fixed)

FilteringSelect and XmlStore default value problem

Reported by: Ian Fouls Owned by: Jared Jurkiewicz
Priority: high Milestone: 1.4
Component: DojoX Data Version: 1.3.0
Keywords: FilteringSelect XmlStore value select Cc:
Blocked By: Blocking:

Description

When a FilteringSelect? control is delcared to use an XmlStore? data source the 'value' attribute does not successfully select the item in the list and the displayed value is blank.

Example:

<div dojoType="dojox.data.XmlStore?" jsId="contentTypesStore" rootItem="content_types" sendQuery="false" keyAttribute="name" label="name" url="/cms/templates/content_types.xml"></div>

<input dojoType="dijit.form.FilteringSelect?" store="contentTypesStore" searchAttr="name" id="content_type_name" name="content_type_name" size="20" value="Text and Images">

Attachments (4)

content_types.json (2.7 KB) - added by Ian Fouls 10 years ago.
JSON datat source
content_types.xml (3.8 KB) - added by Ian Fouls 10 years ago.
XML data source
test-xml.php (1.6 KB) - added by Ian Fouls 10 years ago.
PHP page file
XmlStore_fbid.patch (5.3 KB) - added by Jared Jurkiewicz 10 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 10 years ago by bill

You'll need to attach a test case using the attach file button, and list the steps to reproduce.

There isn't any special handling for XmlStore in FilteringSelect, or vice-versa; maybe it's a problem with the data.

comment:2 Changed 10 years ago by Jared Jurkiewicz

I need a testcase with data that is causing a failure.

Thanks.

Changed 10 years ago by Ian Fouls

Attachment: content_types.json added

JSON datat source

Changed 10 years ago by Ian Fouls

Attachment: content_types.xml added

XML data source

Changed 10 years ago by Ian Fouls

Attachment: test-xml.php added

PHP page file

comment:3 Changed 10 years ago by Ian Fouls

Please see the attached files.

The page has 2 FilteringSelect? controls, one using an XmlStore? the other using ItemFileReadStore?. Both FilteringSelect? controls display the correct data from the source, and update the control when an item is selected, additionally both controls update the 'value' attribute correctly.

The FilteringSelect? attached to the XmlStore? however does not select the store item containing the data in the 'value' attribute when the control is loaded.

comment:4 Changed 10 years ago by Jared Jurkiewicz

Yeah, I see what you're hitting. A quick workaround is to remove the 'rootItem' declaration on XmlStore?. Since all your immediate children of your toplevel tag in your XML document are your child items, you don't need to specify it. With that not set, it loads/works fine

There's some small issue in XmlStore? when rootItem is set and keyAttribute is set. I'll look look at this. Should be an easy fix, to be honest.

comment:5 Changed 10 years ago by Jared Jurkiewicz

Ah, okay, I see the problem. It's usage error.

You're specifying rootItem as the root document node. That's not what rootItem is for. It's for specifying what tag names are classed as a a core (non-child) item.

http://docs.dojocampus.org/dojox/data/XmlStore

In this specific case it's basically killing the search. You can leave off rootItem, or change it to be 'content_type' so that all content_type tags are treated as root level items. In either event, that's the primary cause of your issue. I tried both removing it, and just changing it, and it worked as expected.

It has exposed a potential bug, though, and that is with searching in fetchItemByIdenity. Looks like it should be passing deep: true down (since all fetch item by identity does in this case is call fetch with a specific query). I'll fix that, but ultimately the core problem is the rootItem usage isn't what it should be for that scenario.

comment:6 Changed 10 years ago by Ian Fouls

Many thanks Jared. Yes I misread the definition of rootItem, I bet this is/will be a common error since the XmlStore? has had the getIdentity fix applied and is now usable.

comment:7 Changed 10 years ago by Jared Jurkiewicz

Probably. I also have a fix for the recursive search issue. It's not much of a change and needed to be done. Your mistake actually did expose a bug on using rootItem with fetchByIdentity. I've just patched that. Will be attaching patch shortly and checking in.

Changed 10 years ago by Jared Jurkiewicz

Attachment: XmlStore_fbid.patch added

comment:8 Changed 10 years ago by Jared Jurkiewicz

Milestone: tbd1.4

FBID issue fixed in: [17382]

comment:9 Changed 10 years ago by Jared Jurkiewicz

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.