Opened 7 years ago

Closed 7 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)

screenshot_1118.jpg (35.8 KB) - added by fredfortier 7 years ago.
Image showing the behavior
screenshot_1123.jpg (146.9 KB) - added by fredfortier 7 years ago.
Requests / responses from the server

Download all attachments as: .zip

Change History (11)

Changed 7 years ago by fredfortier

Attachment: screenshot_1118.jpg added

Image showing the behavior

comment:1 Changed 7 years ago by bill

Component: DijitDijit - Form
Owner: changed from bill to fredfortier
Status: newpending

Please attach full test case, including any needed server code. Also, is this really failing on 1.8 or did you mismark the version?

Last edited 7 years ago by bill (previous) (diff)

comment:2 in reply to:  1 Changed 7 years ago by fredfortier

Status: pendingnew

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?

Changed 7 years ago by fredfortier

Attachment: screenshot_1123.jpg added

Requests / responses from the server

comment:3 Changed 7 years ago by bill

Owner: changed from fredfortier to Douglas Hays
Status: newassigned

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 7 years ago by Douglas Hays

Summary: Combobox/FileteringSelect with QueryReadStore - Paging issuesCombobox/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 7 years ago by fredfortier

"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 7 years ago by Douglas Hays

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 7 years ago by Douglas Hays

Owner: changed from Douglas Hays to fredfortier
Status: assignedpending

comment:8 Changed 7 years ago by fredfortier

Status: pendingnew

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 7 years ago by Douglas Hays

Resolution: worksforme
Status: newclosed

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

Note: See TracTickets for help on using tickets.