-
12 Mar 2013 2:15 PM #1
De-selecting from MultiSelect w/selection mode: "single" throws exception
De-selecting from MultiSelect w/selection mode: "single" throws exception
REQUIRED INFORMATION
Ext version tested:- Ext 4.1.3 (Build date: 2012-10-25 15:13:53 (240477695016a85fb9ed1098fd5f8e116327fcc3))
Browser versions tested against:- Chrome Version 25.0.1364.160
DOCTYPE tested against:- html
Description:- De-selecting an item from a MultiSelect item with selection mode set to "single" throws an exception.
Steps to reproduce the problem:- Load the test case below
- Select an item
- Deselect that item
The result that was expected:- The item is deselected, and no exception is thrown
The result that occurs instead:- The item is deselected, but an exception is thrown: "Uncaught TypeError: Object [object Array] has no method 'getBoundingClientRect' "
Test Case:
Code:<!DOCTYPE html> <html> <head> <title>MultiSelect singleSelect deselect Bug</title> <link type="text/css" rel="stylesheet" href="../extjs4/resources/css/ext-all.css" /> <script type="text/javascript" src="../extjs4/ext-all-debug-w-comments.js"></script> <script type="text/javascript" src="../extjs4/ux/form/MultiSelect.js"></script> <script type="text/javascript"> Ext.onReady(function() { Ext.create("Ext.form.Panel", { renderTo : Ext.getBody(), items : [ { id : "MultiSelect1", xtype : "multiselect", height : 250, width : 300, store : [ [ "1", "Item 1" ], [ "2", "Item 2" ], [ "3", "Item 3" ] ], listConfig : { selModel : { allowDeselect : true, mode : "single" } } } ] }); new Ext.Button({ renderTo : Ext.getBody(), text : "getValue", handler : function() { console.log("value : " + Ext.encode(Ext.getCmp("MultiSelect1").getValue())); } }); }); </script> </head> <body> </body> </html>
HELPFUL INFORMATION
Debugging already done:- The error appears to originate with the assignment of "record" in "doSingleSelect": Code:
record = records.length ? records[0] : records;
After this assignment, "record" is a zero length array, which means that it gets the selectedItemCls "x-boundlist-selected" assigned to it on down the chain. That causes code up and down the line, specifically getXY, to treat it as a non-empty element.
Simply suppressing the exception is not really a great solution, in my view, since we're expecting *no* selection to be returned, and instead the selectionChange events are propagating this object:Possible fix:Code:[className: "x-boundlist-selected"]
- None provided
-
13 Mar 2013 9:31 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 435
Thanks for the report! I have opened a bug in our bug tracker.
-
18 Mar 2013 6:40 AM #3
-
19 Mar 2013 11:19 AM #4
We have not been able to find a workaround for this that doesn't involve editing the extjs code itself. I'm reluctant to do that, since a future upgrade that includes a patch from Sencha using a different fix would potentially break this.
The nearest I've been able to come to a workaround is to hack the MultiSelect by:
* Setting the selection mode to "multi"
* Adding a listener to force only the most-recently selected item to remain selected
Is there any other workaround that would be better to consider?
--T
You found a bug! We've classified it as
EXTJSIV-9118
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.


Reply With Quote