4 Replies Latest reply on Sep 26, 2011 5:12 PM by Kristin95762

    Undesired Shift+Click behavior, multi select in datagrid

    Kristin95762 Level 1

      I found an example in the Adobe help files that I have tried to implement, but it doesn't work the same for me as it does in the example. Maybe because the data is hard coded. My datagrid is loaded from sqlite table.


      When I use Shift+click to select multiple items in the list, the first item selected appears twice. I sort of understand why that happens, but why is it acting different in my code vs. Adobe's code, and how can I avoid this behavior?


      My code is exactly the same except I'm using a dataGrid and not a list, and that I had to add ".title" after the selItems[i] in order for it to not show [object Object] in the text area control, Adobe's example didn't require that. What's different there? I'm using Spark controls.


      http://help.adobe.com/en_US/flex/using/WSc2368ca491e3ff923c946c5112135c8ee9e-7fff.html     scroll to the discussion on "Handling multiple selection in the Spark List control".

      my code:


      import spark.events.GridSelectionEvent;


      ... functions to initialize database, execute sqlstatement, assign data to the grid are omitted



      protected function myDG_selectionChangeHandler(event:GridSelectionEvent):void


      var selIndices:Vector.<int> = event.currentTarget.selectedIndices;

      var selItems:Vector.<Object> = event.currentTarget.selectedItems;

      var numItems:Number = selIndices.length;


      for (var i:Number = 0; i<numItems; i++)


      selectedItemsTA.text = selectedItemsTA.text + selItems[i].title + "\n";