Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#9517 closed defect (fixed)

ComboBox does dropdown with Rest Store on Safari 4.0

Reported by: vlad Owned by: Kris Zyp
Priority: high Milestone: 1.4
Component: DojoX Data Version: 1.3.1
Keywords: combobox, filteringSelect, restStore Cc:
Blocked By: Blocking:

Description

using trunk (latest) dojo

the combo box simply does not work. Nothing gets dropped down, no error no anything.

To replicate the problem you need the attached simple HTML (a php file) and a Rest Store backend. The backend is also also a php file that simply returns '[]' So one-liner backend can be done in any language, very simple.

Just click on the add button, it will add items to the store. Then go to combo box pull down -- and you will see that on Safari 4.0 nothing happens (I am running PC version of safari 4.0)

On other browsers, you will get a pull down, but also you will receive an error in ServiceStore?

defResult.ioArgs is undefined defResult.ioArgs.xhr.abort();

This is a separate bug, and I am entering separate issue for it, using the same test case.

Attachments (4)

REST_STORE_1.php (7.5 KB) - added by vlad 10 years ago.
the main test case
json_rest_store_backend.php (35 bytes) - added by vlad 10 years ago.
php file returning an empty json array [] (needed for rest store)
FILT_SELECT_REST_PROB_1.php (4.3 KB) - added by vlad 10 years ago.
FilteringSelect? on Safari test case
json_rest_store_backend_some_itms.php (177 bytes) - added by vlad 10 years ago.
updated backend store script, uncomment the line that echos at least one item to see Filtering Select working on Safari 4

Download all attachments as: .zip

Change History (10)

Changed 10 years ago by vlad

Attachment: REST_STORE_1.php added

the main test case

Changed 10 years ago by vlad

Attachment: json_rest_store_backend.php added

php file returning an empty json array [] (needed for rest store)

comment:1 Changed 10 years ago by vlad

just a note that the bug related to errors within Rest Stores and combo box (that uses the same attached files to reproduce) is http://bugs.dojotoolkit.org/ticket/9518

comment:2 Changed 10 years ago by bill

This is a pretty big test case, and there are a lot of things I don't understand about it. Can you make a simpler test case? I simplified it but after hitting the add button I query the store, like below:

testStore.fetch({onComplete: function(ary){ console.log(ary); } });

I don't see any data in the store.

Things I'm unclear about:

  • your faux server json_rest_store_backend.php doesn't persist the items that the client is presumably sending to it via POST calls... how is that supposed to work? Is it depending on ClientFilter to do caching on the client?
  • the query specified to FilteringSelect: query="{ id: '*' }" isn't in the right format for PersevereStore, is it?

Changed 10 years ago by vlad

Attachment: FILT_SELECT_REST_PROB_1.php added

FilteringSelect? on Safari test case

Changed 10 years ago by vlad

updated backend store script, uncomment the line that echos at least one item to see Filtering Select working on Safari 4

comment:3 Changed 10 years ago by vlad

Hi, thank you for looking at the issue so quickly. Sorry, the test case was a bit more than it needed to be.

I simplified it a lot.

a) removed or border containers stuff

b) changed to JsonRestStore? (not perserver anymore)

c) I left just one Grid in to show that the Grid works fine with the same store.

d) and this is probably the most important discovery that I made today. The Filtering Select works on safari 4.0 when initially there was at least one item in the store. It does not work only when there are no items in the store initially.

So I am attaching with this new test case, a new backend script that 'mimics' that there is one item in the store (you have to uncomment it) -- and in that case the filtering select will work.

e) this is likely a separate issue but on Opera 10 the arrow down is not visible on the filtering select

Other than that the test case works on all the other browsers

f) On any any browser if you run the test case you will see that with initial empty store , after you add rows using the button -- the filtering select will show a pulldown with entries, however right after that you will receive an error from ServiceStore?.js I entered a separate bug for this in ServiceStore? (9518). On Safari, however, the pulldown does not work even after items are added to the store *if* at the load time the store was empty. So for my needs I modified the code for ServiceStore? to get me going, but could not do anything with the FilteringSelect?/safari combination (that's why I entered this bug).

--- As far as other things. query '*' works for perservere stores too.

Yes the there is no data in the database, but for the test case it is not needed because the data is 'cached' in the 'store' -- that's why cache:true was set on the grid (so the store will cache the query generated by the grid )

comment:4 Changed 10 years ago by bill

Component: DijitDojoX Data
Owner: set to Kris Zyp

I've traced through the code (both dijit and dojox). As you said, ClientFilter is doing client side caching, so even though your mock-service isn't processing the updates correctly, it's irrelevant.

The problem is that ComboBox does a query with count: Infinity, and then dojox.data.ClientFilter::updateResultSet() has some code:

if(request.count && updated){
	// do we really need to do this?
	// make sure we still find within the defined paging set
	resultSet.splice(request.count,resultSet.length);
}

resultSet is an array of length 4, so it's doing resultSet.splice(Infinity, 4) which truncates the array on safari.

Passing to Kris to fix since that code doesn't make sense to me. It seems like it should be doing this:

resultSet.splice(request.start, request.count);

Making that change does fix the problem, although I didn't do extensive testing... a good way to test would be to set the ComboBox pageSize=3 (or something small) and then make sure paging through the drop down results works.

comment:5 Changed 10 years ago by Kris Zyp

Resolution: fixed
Status: newclosed

(In [20841]) Check for Infinity before doing splice to correct for Safari issue, fixes #9517

comment:6 Changed 10 years ago by Kris Zyp

Milestone: tbd1.4
Note: See TracTickets for help on using tickets.