Opened 8 years ago
Closed 8 years ago
#15951 closed defect (worksforme)
Combobox/FilteringSelect with QueryReadStore - Paging issues
Reported by: | fredfortier | Owned by: | fredfortier |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | Dijit - Form | Version: | 1.8.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
It appears that the Combobox/FilteringSelect? does not understand well the content of a QueryReadStore?. For example, I set my pageSize to 5 - if the store only has two items, it still shows "more choices" - if I click on "more choices", the browser blows up (stack overflow on IE8 - unresponsive script on Firefox). There are more minor issues as well, with paging with larger item sets (previous choices shows wrong number of items). I see a couple issues open around FilteringSelect? / QueryReadStore? but not this one exactly.
Here is my code:
var store = new Autocomplete({ url:this.util.getRestServletPath() + "?Operation=queryAutocomplete", requestMethod:"get", propertyName:constants.PROPERTY_OwnerID }); this._ownerIdList = new FilteringSelect( { name:"OwnerIDs", labelAttr:"label", searchAttr:"criterion", store:store, pageSize:"5", style:"width:300px;" } );
Autocomplete.js:
define(["dojo/_base/declare", "dojox/data/QueryReadStore"], function (declare, QueryReadStore) { return declare("Autocomplete", [QueryReadStore], { propertyName:null, fetch:function (request) { request.serverQuery = { propertyName:this.propertyName, q:request.query.criterion.replace("*", "") }; return this.inherited("fetch", arguments); } }); });
Attachments (2)
Change History (11)
Changed 8 years ago by
Attachment: | screenshot_1118.jpg added |
---|
comment:1 follow-up: 2 Changed 8 years ago by
Component: | Dijit → Dijit - Form |
---|---|
Owner: | changed from bill to fredfortier |
Status: | new → pending |
Please attach full test case, including any needed server code. Also, is this really failing on 1.8 or did you mismark the version?
comment:2 Changed 8 years ago by
Status: | pending → new |
---|
Replying to bill:
Please attach full test case, including any needed server code. Also, is this really failing on 1.8 or did you mismark the version?
Yes, 1.8. Server-side code? That's a little trickier. Anything in particular that you are looking for. Attached the JSON payload returned by the server. Is this sufficient?
comment:3 Changed 8 years ago by
Owner: | changed from fredfortier to Douglas Hays |
---|---|
Status: | new → assigned |
Wanted the testcase both to reproduce the bug, which is necessary for fixing it, and to see if the problem was in your server.
The question is: why is this failing for you but not for our internal testcases in dojox/form/tests?
comment:4 Changed 8 years ago by
Summary: | Combobox/FileteringSelect with QueryReadStore - Paging issues → Combobox/FilteringSelect with QueryReadStore - Paging issues |
---|
If I modify dojox/data/tests/stores/QueryReadStore.php to only have 2 items then dojox/data/demos/demo_QueryReadStore_FilteringSelect.html is this exact scenario as it sets pagesize=10. I put a copy of the 1.8 branch with this change to show it works on
http://doughays.dojotoolkit.org/18x/dojox/data/demos/demo_QueryReadStore_FilteringSelect.html
and it works well. If "More choices" is showing up, then the "total" number of items is coming back incorrectly from your store as it should be a Promise object.
comment:5 Changed 8 years ago by
"If "More choices" is showing up, then the "total" number of items is coming back incorrectly from your store as it should be a Promise object." - Ok but it does not really help. You see the JSON payload in the screenshot. My code is Java based but it should not matter, it is just serializing the payload that you see. Is there anything wrong with the payload returned by the server that would induce the behavior that you are describing?
comment:6 Changed 8 years ago by
Where does your java set "numRows" on return (which gets translated to total)? This is a sibling to "items" in the response object.
comment:7 Changed 8 years ago by
Owner: | changed from Douglas Hays to fredfortier |
---|---|
Status: | assigned → pending |
comment:8 Changed 8 years ago by
Status: | pending → new |
---|
You can see it in the response from the attached Firebug screenshot. numRows is sibling of items. It does reflect the correct total (you can double check). The server code is just serializing this store payload. I noticed that this store is using the old data API. Should I be using a different store? I cannot find any documented Autocomplete implementation other that the pattern that I used. I can have the server serialize any kind of JSON and can use any store on the client. But this particular implementation is triggering stack overflows when clicking "more choices".
comment:9 Changed 8 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
I created a test page showing this is working:
http://doughays.dojotoolkit.org/15951/15951.html
Feel free to download a complete zip to your web server to find out what is broken with your server-side code:
http://doughays.dojotoolkit.org/15951/15951.zip
Image showing the behavior