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.
  1. #1
    Sencha Premium Member
    Join Date
    Feb 2013
    Location
    Austin, TX
    Posts
    3
    Vote Rating
    0
    tschmelterRev is on a distinguished road

      0  

    Default 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:
    Code:
    [className: "x-boundlist-selected"]
    Possible fix:
    • None provided

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,599
    Vote Rating
    435
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Thanks for the report! I have opened a bug in our bug tracker.

  3. #3
    Sencha Premium Member
    Join Date
    Feb 2013
    Location
    Austin, TX
    Posts
    3
    Vote Rating
    0
    tschmelterRev is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    Thanks for the report! I have opened a bug in our bug tracker.
    Hi Mitchell,

    Do you have an update on this? We're entering the last stage of testing our next release, and this is a blocking issue for us.

    --Tim

  4. #4
    Sencha Premium Member
    Join Date
    Feb 2013
    Location
    Austin, TX
    Posts
    3
    Vote Rating
    0
    tschmelterRev is on a distinguished road

      0  

    Default


    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