Opened 11 years ago

Closed 11 years ago

Last modified 8 years ago

#9059 closed defect (fixed)

FilteringSelect: _setValueAttr fails for lazy-loaded items from store

Reported by: Jarrod Carlson Owned by: bill
Priority: high Milestone: 1.4
Component: Dijit - Form Version: 1.3.0
Keywords: dijit form filteringselect Cc:
Blocked By: Blocking:

Description

If a FilteringSelect? is tied to a store that supports lazy-loading, when setting the value of the select to an item which is not loaded, the _callbackSetLabel function (line 62) fails to deal with the result argument when it is not an array.

It would seem that if the item is already loaded, FilteringSelect?'s handleFetchItemByIdentity wraps the item into an array before calling _callbackSetLabel. If the item is not loaded, it is loaded but not wrapped into an array, causing _callbackSetLabel to fail.

if(self.store.isItemLoaded(item)){
    self._callbackSetLabel([item], undefined, priorityChange);
} else {
    self.store.loadItem({
        item: item, 
        onItem: function(result, dataObject){
            self._callbackSetLabel(result, dataObject, priorityChange);
        }
    });
}

This bug causes a call to attr("value", "123") to fail completely for the FilteringSelect?, leaving the input with a blank value.

Attached is a test page demonstrating the problem using an ItemFileReadStore? (non-lazy) versus a JsonRestStore? (lazy). You might need to do some setup on your web server to make the JSON data serve properly.

This problem does appear to be related to #3347.

Attachments (4)

test_FilteringSelect_DataStore.html (2.3 KB) - added by Jarrod Carlson 11 years ago.
FilteringSelect? with Lazy-Loading Store
data (312 bytes) - added by Jarrod Carlson 11 years ago.
JSON Data "/test/data"
3 (87 bytes) - added by Jarrod Carlson 11 years ago.
JSON Data "/test/data/3"
FilteringSelect.js.diff (545 bytes) - added by Jarrod Carlson 11 years ago.
Proposed patch

Download all attachments as: .zip

Change History (9)

Changed 11 years ago by Jarrod Carlson

FilteringSelect? with Lazy-Loading Store

Changed 11 years ago by Jarrod Carlson

Attachment: data added

JSON Data "/test/data"

Changed 11 years ago by Jarrod Carlson

Attachment: 3 added

JSON Data "/test/data/3"

Changed 11 years ago by Jarrod Carlson

Attachment: FilteringSelect.js.diff added

Proposed patch

comment:1 Changed 11 years ago by bill

Thanks. It is sort of related to #9023 in that maybe we can get rid of that code altogether.

comment:2 Changed 11 years ago by Jarrod Carlson

I don't think you can get rid of that bit of unpleasant code - at least not yet. See #9061 for an explanation.

comment:3 Changed 11 years ago by bill

Milestone: tbd1.4
Owner: set to bill
Status: newassigned

OK, now that #9061 is fixed I'm just going to remove that block of code from FilteringSelect.

comment:4 Changed 11 years ago by bill

Resolution: fixed
Status: assignedclosed

Code (with the bug) removed in [17225], although after the fix to #9061 that code was inert anyway.

comment:5 Changed 8 years ago by bill

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