Opened 11 years ago

Closed 11 years ago

Last modified 8 years ago

#6690 closed defect (worksforme)

QueryReadStore + ComboBox / FilteringSelect + paging

Reported by: guest Owned by: haysmark
Priority: high Milestone: 1.2
Component: Dijit - Form Version: 1.1.0
Keywords: Cc:
Blocked By: Blocking:

Description

Using the exemple provided at http://archive.dojotoolkit.org/nightly/checkout/dojox/data/tests/QueryReadStore.html

1) Set the page to 10 2) ChangeQueryReadStore?.php to send only 10 results

$allItems = array(
	array('name'=>"Alabama", 'label'=>"<img src='images/Alabama.jpg'/>Alabama", 'abbreviation'=>"AL"),
	array('name'=>"Alaska", 'label'=>"Alaska", 'abbreviation'=>"AK"),
	array('name'=>"American Samoa", 'label'=>"American Samoa", 'abbreviation'=>"AS"),
	array('name'=>"Arizona", 'label'=>"Arizona", 'abbreviation'=>"AZ"),
	array('name'=>"Arkansas", 'label'=>"Arkansas", 'abbreviation'=>"AR"),
	array('name'=>"Armed Forces Europe", 'label'=>"Armed Forces Europe", 'abbreviation'=>"AE"),
	array('name'=>"Armed Forces Pacific", 'label'=>"Armed Forces Pacific", 'abbreviation'=>"AP"),
	array('name'=>"Armed Forces the Americas", 'label'=>"Armed Forces the Americas", 'abbreviation'=>"AA"),
	array('name'=>"California", 'label'=>"California", 'abbreviation'=>"CA"),
	array('name'=>"Colorado", 'label'=>"Colorado", 'abbreviation'=>"CO")
);

The comboBox widget and FilteringSelect? widget will display 10 results : Alabama -> Colorado + "More choice" item

But there is no more choices as there is only 10 results !

The problem come from dijit.form._ComboBoxMenu

  createOptions:function
this.nextButton.style.display=dataObject.count==results.length?"":"none";

This line indicates that "Next" button must be displayed if "retrieved results count" == "pageSize".

But this is not the right test to know if there more elements to display. Only the server-side can determine this.

Ektor.

Attachments (2)

dijit.form.ComboBox_20080507.patch (2.8 KB) - added by Jared Jurkiewicz 11 years ago.
Patch to make ComboBox? smarter on how it determines if 'more' should be shown.
6690.patch (2.1 KB) - added by haysmark 11 years ago.
Patch to make ComboBox? smarter on how it determines if 'more' should be shown. Fixes #6690.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 11 years ago by Adam Peller

Component: GeneralDojoX Data
Owner: changed from anonymous to Jared Jurkiewicz

Jared, can you assess and assign to Dijit if appropriate?

comment:2 Changed 11 years ago by Jared Jurkiewicz

This is a widget problem. The widget can know how many total matches there on by looking at onBegin to see how many total matches there were for a particular query (providing the datastore reports it. If the widget gets -1, all it can do is guess).

But I know QueryReadStore? properly returns to onBegin. SO, it's a problem with the widget not listening to onBegin and setting expectations based on that. (On whether there is more or not).

Changed 11 years ago by Jared Jurkiewicz

Patch to make ComboBox? smarter on how it determines if 'more' should be shown.

comment:3 Changed 11 years ago by Jared Jurkiewicz

Component: DojoX DataDijit
Owner: Jared Jurkiewicz deleted

Routing over to the dijit folks for review. Don't claim the patch is beautiful, just something quick I worked up this afternoon after looking at the ComboBox? code for a few minutes.

comment:4 Changed 11 years ago by bill

Milestone: 1.2
Owner: set to haysmark

Looks fine to me; if OK to Mark then I'll check it in.

comment:5 Changed 11 years ago by haysmark

I looked at Jared's code today and I couldn't get it to patch against the trunk. I merged the changes manually and I'm going to attach a new patch.

Changed 11 years ago by haysmark

Attachment: 6690.patch added

Patch to make ComboBox? smarter on how it determines if 'more' should be shown. Fixes #6690.

comment:6 Changed 11 years ago by haysmark

Bill, I think it is ok to commit this patch. I just attached a new one with more recent line numbers.

comment:7 Changed 11 years ago by bill

Resolution: fixed
Status: newclosed

(In [13726]) Fix detection of whether there's more data to fetch or not. Fixes #6690. Patch from Jared (IBM, CCLA).

!strict

comment:8 Changed 11 years ago by guest

Resolution: fixed
Status: closedreopened

I have do a simple test for this changeset it can work when there's only 2 pages , but when there's more pages it seems can't show more that 2 pages. I have gone throw the codes and in the debug i found seems there's some problem when judge whether should show "more choice".

Can anybody recheck the codes in changeset 13726 and do more tests? Thanks !

PS: i also want to know when will this changeset can be built in the formal package, thanks~

comment:9 Changed 11 years ago by haysmark

Post the code for your simple test.

We have many tests with more than 2 pages and they all work. The QueryReadStore? test linked in the description has a pageSize of 5 and shows lots of pages. Also, using test_ComboBox I verified that the second ComboBox? with ItemFileReadStore? worked when I set 62 items in the data store and set the pageSize to 31 (exactly 2 pages) and 62 (exactly 1 page).

comment:10 Changed 11 years ago by haysmark

Resolution: worksforme
Status: reopenedclosed

comment:11 Changed 8 years ago by bill

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