Opened 12 years ago

Closed 11 years ago

Last modified 9 years ago

#6469 closed defect (fixed)

[patch] FilteringSelect: newlines in inline data not trimmed

Reported by: reiz6153@… Owned by: haysmark
Priority: high Milestone: 1.2
Component: Dijit - Form Version: 1.1.0
Keywords: Cc: Jared Jurkiewicz
Blocked By: Blocking:

Description

I study along with The Dojo Book and program in the MyEclipse?. I learn Example 2 - The Postman Always Clicks Twice. When I program FilteringSelect?, the problem occured. At first, my code is: <select id="option1" dojoType="dijit.form.FilteringSelect?">

<option value="pop3">POP3</option> <option value="imap">IMAP</option>

</select> It has work well. But when I format using MyEclipse?'s Format functionality, my code changes to: <select id="option1" dojoType="dijit.form.FilteringSelect?">

<option value="pop3">

POP3

</option> <option value="imap">

IMAP

</option>

</select> It doesn't work well. Note: Carriage Return appear alongside "POP3" and "IMAP". I guess this is a bug of Dojo 1.0.0. Because of I'm a Chinese, I don't be easy to login in this web site. Whether this is a bug or not, please notify me using Email. Thanks a lot. My email address: reiz6153@…

Attachments (2)

6469.dijit.patch (825 bytes) - added by haysmark 11 years ago.
Fixes #6469. Strip option tags of newlines; users usually don't intend for them to be there.
6469.dojo.patch (411 bytes) - added by haysmark 11 years ago.
Refs #6469. Enable dojo.data to match against values containing newline characters.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 12 years ago by bill

Component: HTMLDijit
Milestone: 1.2
Owner: changed from sjmiles to bill
Priority: highestnormal
Reporter: changed from guest to reiz6153@…
Summary: FilteringSelect doesn't workFilteringSelect: newlines in inline data not trimmed

Changing bug summary to be more descriptive than "doesn't work". Note that every ticket is about something that doesn't work.

Looks like a simple fix to dijit.form._ComboBoxDataStore.

comment:2 Changed 11 years ago by haysmark

Cc: Jared Jurkiewicz added
Owner: changed from bill to haysmark

I am also getting this behavior with dojo.data. In states.json, if you write:

	{name:"\nAlaska\n", label:"Alaska",abbreviation:"AK"},

Alaska will vanish from the ComboBox? list (dojo.data does not return it in the result list). The item is in the store, but even a query for '*' does not match it.

I say this because I noticed a mixin to our store I don't remember:

//Mix in the simple fetch implementation to this class. 
dojo.extend(dijit.form._ComboBoxDataStore,dojo.data.util.simpleFetch);

So maybe if we can figure this out for dojo.data the rest will follow.

comment:3 Changed 11 years ago by bill

Hmm, that does sound like a bug in the dojo.data library functions, but regardless of that, it seems like if a developer accesses an item from ComboBoxDataStore (perhaps by accessing ComboBox.item), it would be bad for it to contain newlines like:

{name:"\nAlaska\n", label:"Alaska",abbreviation:"AK"}

I just figured we should trim the data from each <option> tag.

Changed 11 years ago by haysmark

Attachment: 6469.dijit.patch added

Fixes #6469. Strip option tags of newlines; users usually don't intend for them to be there.

Changed 11 years ago by haysmark

Attachment: 6469.dojo.patch added

Refs #6469. Enable dojo.data to match against values containing newline characters.

comment:4 Changed 11 years ago by haysmark

Status: newassigned

I've attached two patches: one for ComboBoxDataStore? and one for dojo.data. I thought it would be good if dojo.data could match values even if they contained newlines.

comment:5 Changed 11 years ago by haysmark

I ran the dojo.data patch against the doh tests in dojo and dojox on Firefox 2, IE 7, and Safari 3.1 and they all passed.

comment:6 Changed 11 years ago by haysmark

Summary: FilteringSelect: newlines in inline data not trimmed[patch] FilteringSelect: newlines in inline data not trimmed

comment:7 Changed 11 years ago by Jared Jurkiewicz

Resolution: fixed
Status: assignedclosed

(In [14312]) Fix to ComboBox?. fixes #6469

comment:8 Changed 11 years ago by Jared Jurkiewicz

(In [14313]) Fix to ComboBox?. refs #6469

comment:9 Changed 11 years ago by bill

(In [14323]) Use dojo.trim(). replace() is insufficient since it doesn't remove spaces or tabs.

The other option is to do trimming on lookup rather than on instantiation. We should do that if current strategy affects page load time significantly.

Refs #6469. !strict

comment:10 Changed 9 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.