You found a bug! We've classified it as
EXTJS-14804
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
-
Sencha User
Ext.selection.Model toggleOnClick broken
See https://fiddle.sencha.com/#fiddle/9bl for an example
It appears that the toggleOnClick option of the Ext.selection.Model class is not functional due to the fact that its implementation in the source code is unreachable. The example is configured to use the toggleOnClick option of the Ext.selection.Model class. The selection mode is set to 'SINGLE' and allowDeselect is set to true.
You can reproduce the problem by:
Clicking once on an item in the DataView should cause it to become selected (it will turn from blue to green).
Clicking the selected item once again should de-select the item (it should turn back to blue).
Here is the source file that I have found the problem in: http://docs.sencha.com/extjs/5.0/api...election-Model
Within the source of the Ext.selection.Model class the only place that references the toggleOnClick var is in the selectWithEvent function on line 277 where it is only used in the case of a 'SINGLE' selection mode.
However, the only place where the selectWithEvent function is called is from the onNavigate function on line 387 were it is only called in the case of a 'MULTI' selection mode
It is impossible for the selection mode to be both MULTI and SINGLE. Therefore the implementation of toggleOnClick is not reachable.
Perhaps a subclass does something differently, however the Ext.selection.DataViewModel that I have used in the example does not change this behavior.
-
Thanks for the report! I have opened a bug in our bug tracker.
-
Sencha Premium User
This issue is not fixed yet 5 years later (Ext JS 7.0).