      */
     private function getGridDataProviderLength():uint
     {
+        if (grid == null)
+            return 0;
+        
         const dataProvider:IList = grid.dataProvider;
         return (dataProvider) ? dataProvider.length : 0;
     }    

    
    /**
     *  @private
     *  Selected rows.  Vector of rowIndexes that map to the dataProvider items.
     */    
    private var grid:Grid;

    /**
     *  @private
     *  Vector of rowIndexes that map to the dataProvider items.  If 

    
    /**
     *  @private
     *  To connect the selection with its grid.  Can't be in the constructor
     *  since the selectionMode might be set before the grid part is added.
     */
    private function get grid():Grid
    {
        return gridOwner.grid;
    }
    
    /**
     *  @private
     */
    private function isRowSelectionMode():Boolean
    {
