#10276 closed defect (fixed)
FilteringSelect: error on "more choices" when number of option equals pagesize
Reported by: | Jean-Pascal Laux | Owned by: | Douglas Hays |
---|---|---|---|
Priority: | low | Milestone: | 1.5 |
Component: | Dijit - Form | Version: | 1.3.2 |
Keywords: | Cc: | Jared Jurkiewicz | |
Blocked By: | Blocking: |
Description
I repost this problem again with more details.
When the pagesize equals the number of options, the "More choice" option appears (even if there is no more option) and when I click on, I receive an error in the text field.
I attach an example that shows the problem.
Attachments (2)
Change History (7)
Changed 11 years ago by
comment:1 Changed 11 years ago by
Milestone: | tbd → 1.5 |
---|---|
Owner: | set to Douglas Hays |
Summary: | FilteringSelect with PageSize attribute when number of option equals pagesize → FilteringSelect: error on "more choices" when number of option equals pagesize |
Not sure if we can avoid the "more choices" option from appearing but hopefully can avoid the error and just display a drop down menu with the "previous choices" button.
comment:2 Changed 11 years ago by
Cc: | bill added |
---|
Bill, it appears that [13726] added the following:
if((dataObject.start + dataObject.length) > (dataObject._maxOptions - 1)){ //Weird return from a datastore, where a start + count > maxOptions //implies maxOptions isn't really valid and we have to go into faking it. //And more or less assume more if count == results.length if(dataObject.count == results.length){ displayMore = true; }
In this case, start=0, length/count/_maxOptions=20, and (0+20) > (20-1)
and so "More Choices" is shown even though the comment suggests the condition
should be (0+20) > 20.
Bill can you shed any light on whether or not the test here
should be > 19 or > 20 ?
comment:3 Changed 11 years ago by
Cc: | Jared Jurkiewicz added; bill removed |
---|
It seems like you are right, that the test should be > 20, although that's actually Jared's code. But maybe we should just get rid of that if() altogether, since it's not ComboBox's job to deal with malfunctioning stores.
Having said that, ComboBox shouldn't error when the next page turns out to be empty. Like the comments in the code say, some stores can't predict how many results a query will return, and in that case ending up w/an empty page is sometimes unavoidable. (I'm talking about when the onBegin() callback is called with -1, rather than the total count, and dataObject._maxOptions gets set to -1.)
Changed 11 years ago by
Attachment: | 10276.patch added |
---|
don't add More choices if the exact number of entries are returned. Allow More choices to return no additional entries. Allow up/down arrow to wrap menu.
comment:4 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [20976]) Fixes #10276. More choices check was off by 1 causing it to be added when an exact number of items were returned from the store. Add check for maxOptions whenever results are being checked to determine if the query was valid or not. Allow up/down arrow to wrap menu. Add automated testcases.
comment:5 Changed 10 years ago by
Component: | Dijit → Dijit - Form |
---|
Example