Ticket #6690 (closed defect: worksforme)

Opened 7 months ago

Last modified 5 months ago

QueryReadStore + ComboBox / FilteringSelect + paging

Reported by: guest Owned by: haysmark
Priority: normal Milestone: 1.2
Component: Dijit Version: 1.1.0
Severity: normal Keywords:
Cc:

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

dijit.form.ComboBox_20080507.patch (2.8 kB) - added by jaredj 7 months ago.
Patch to make ComboBox? smarter on how it determines if 'more' should be shown.
6690.patch (2.1 kB) - added by haysmark 7 months ago.
Patch to make ComboBox? smarter on how it determines if 'more' should be shown. Fixes #6690.

Change History

Changed 7 months ago by peller

  • owner changed from anonymous to jaredj
  • component changed from General to DojoX Data

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

Changed 7 months ago by jaredj

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 7 months ago by jaredj

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

Changed 7 months ago by jaredj

  • owner deleted
  • component changed from DojoX Data to Dijit

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.

Changed 7 months ago by bill

  • owner set to haysmark
  • milestone set to 1.2

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

Changed 7 months 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 7 months ago by haysmark

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

Changed 7 months ago by haysmark

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

Changed 7 months ago by bill

  • status changed from new to closed
  • resolution set to fixed

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

!strict

Changed 7 months ago by guest

  • status changed from closed to reopened
  • resolution deleted

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~

Changed 7 months 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).

Changed 5 months ago by haysmark

  • status changed from reopened to closed
  • resolution set to worksforme
Note: See TracTickets for help on using tickets.