dojox/grid/Selection.js

  • Provides:

    • dojox.grid.Selection
  • dojox.grid.Selection

    • type
      Function
    • summary
      Manages row selection for grid. Owned by grid and used internally
      for selection. Override to implement custom selection.
    • parameters:
      • inGrid: (typeof )
    • source: [view]
        this.grid = inGrid;
        this.selected = [];


        this.setMode(inGrid.selectionMode);
  • dojox.grid.Selection.mode

    • summary
  • dojox.grid.Selection.selected

    • summary
  • dojox.grid.Selection.updating

    • summary
  • dojox.grid.Selection.selectedIndex

    • summary
  • dojox.grid.Selection.setMode

    • type
      Function
    • parameters:
      • mode: (typeof )
    • source: [view]
        if(this.selected.length){
         this.deselectAll();
        }
        if(mode != 'extended' && mode != 'multiple' && mode != 'single' && mode != 'none'){
         this.mode = 'extended';
        }else{
         this.mode = mode;
        }
    • summary
  • dojox.grid.Selection.onCanSelect

    • type
      Function
    • parameters:
      • inIndex: (typeof )
    • source: [view]
        return this.grid.onCanSelect(inIndex);
    • summary
  • dojox.grid.Selection.onCanDeselect

    • type
      Function
    • parameters:
      • inIndex: (typeof )
    • source: [view]
        return this.grid.onCanDeselect(inIndex);
    • summary
  • dojox.grid.Selection.onSelected

    • type
      Function
    • parameters:
      • inIndex: (typeof )
    • source: [view]
    • summary
  • dojox.grid.Selection.onDeselected

    • type
      Function
    • parameters:
      • inIndex: (typeof )
    • source: [view]
    • summary
  • dojox.grid.Selection.onChanging

    • type
      Function
    • source: [view]
    • summary
  • dojox.grid.Selection.onChanged

    • type
      Function
    • source: [view]
    • summary
  • dojox.grid.Selection.isSelected

    • type
      Function
    • parameters:
      • inIndex: (typeof )
    • source: [view]
        if(this.mode == 'none'){
         return false;
        }
        return this.selected[inIndex];
    • summary
  • dojox.grid.Selection.getFirstSelected

    • type
      Function
    • source: [view]
        if(!this.selected.length||this.mode == 'none'){ return -1; }
        for(var i=0, l=this.selected.length; i   if(this.selected[i]){
          return i;
         }
        }
        return -1;
    • summary
  • dojox.grid.Selection.getNextSelected

    • type
      Function
    • parameters:
      • inPrev: (typeof )
    • source: [view]
        if(this.mode == 'none'){ return -1; }
        for(var i=inPrev+1, l=this.selected.length; i   if(this.selected[i]){
          return i;
         }
        }
        return -1;
    • summary
  • dojox.grid.Selection.getSelected

    • type
      Function
    • source: [view]
        var result = [];
        for(var i=0, l=this.selected.length; i   if(this.selected[i]){
          result.push(i);
         }
        }
        return result;
    • summary
  • dojox.grid.Selection.getSelectedCount

    • type
      Function
    • source: [view]
        var c = 0;
        for(var i=0; i   if(this.selected[i]){
          c++;
         }
        }
        return c;
    • summary
  • dojox.grid.Selection._beginUpdate

    • type
      Function
    • source: [view]
        if(this.updating === 0){
         this.onChanging();
        }
        this.updating++;
    • summary
  • dojox.grid.Selection._endUpdate

    • type
      Function
    • source: [view]
        this.updating--;
        if(this.updating === 0){
         this.onChanged();
        }
    • summary
  • dojox.grid.Selection.select

    • type
      Function
    • parameters:
      • inIndex: (typeof )
    • source: [view]
        if(this.mode == 'none'){ return; }
        if(this.mode != 'multiple'){
         this.deselectAll(inIndex);
         this.addToSelection(inIndex);
        }else{
         this.toggleSelect(inIndex);
        }
    • summary
  • dojox.grid.Selection.addToSelection

    • type
      Function
    • parameters:
      • inIndex: (typeof )
    • source: [view]
        if(this.mode == 'none'){ return; }
        if(dojo.isArray(inIndex)){
         dojo.forEach(inIndex, this.addToSelection, this);
         return;
        }
        inIndex = Number(inIndex);
        if(this.selected[inIndex]){
         this.selectedIndex = inIndex;
        }else{
         if(this.onCanSelect(inIndex) !== false){
          this.selectedIndex = inIndex;
          var rowNode = this.grid.getRowNode(inIndex);
          if(rowNode){
           dojo.attr(rowNode,"aria-selected","true");
          }
          this._beginUpdate();
          this.selected[inIndex] = true;
          //this.grid.onSelected(inIndex);
          this.onSelected(inIndex);
          //this.onSetSelected(inIndex, true);
          this._endUpdate();
         }
        }
    • summary
  • dojox.grid.Selection.deselect

    • type
      Function
    • parameters:
      • inIndex: (typeof )
    • source: [view]
        if(this.mode == 'none'){ return; }
        if(dojo.isArray(inIndex)){
         dojo.forEach(inIndex, this.deselect, this);
         return;
        }
        inIndex = Number(inIndex);
        if(this.selectedIndex == inIndex){
         this.selectedIndex = -1;
        }
        if(this.selected[inIndex]){
         if(this.onCanDeselect(inIndex) === false){
          return;
         }
         var rowNode = this.grid.getRowNode(inIndex);
         if(rowNode){
          dojo.attr(rowNode,"aria-selected","false");
         }
         this._beginUpdate();
         delete this.selected[inIndex];
         //this.grid.onDeselected(inIndex);
         this.onDeselected(inIndex);
         //this.onSetSelected(inIndex, false);
         this._endUpdate();
        }
    • summary
  • dojox.grid.Selection.setSelected

    • type
      Function
    • parameters:
      • inIndex: (typeof )
      • inSelect: (typeof )
    • source: [view]
        this[(inSelect ? 'addToSelection' : 'deselect')](inIndex);
    • summary
  • dojox.grid.Selection.toggleSelect

    • type
      Function
    • parameters:
      • inIndex: (typeof )
    • source: [view]
        if(dojo.isArray(inIndex)){
         dojo.forEach(inIndex, this.toggleSelect, this);
         return;
        }
        this.setSelected(inIndex, !this.selected[inIndex]);
    • summary
  • dojox.grid.Selection._range

    • type
      Function
    • parameters:
      • inFrom: (typeof )
      • inTo: (typeof )
      • func: (typeof )
    • source: [view]
        var s = (inFrom >= 0 ? inFrom : inTo), e = inTo;
        if(s > e){
         e = s;
         s = inTo;
        }
        for(var i=s; i<=e; i++){
         func(i);
        }
    • summary
  • dojox.grid.Selection.selectRange

    • type
      Function
    • parameters:
      • inFrom: (typeof )
      • inTo: (typeof )
    • source: [view]
        this._range(inFrom, inTo, dojo.hitch(this, "addToSelection"));
    • summary
  • dojox.grid.Selection.deselectRange

    • type
      Function
    • parameters:
      • inFrom: (typeof )
      • inTo: (typeof )
    • source: [view]
        this._range(inFrom, inTo, dojo.hitch(this, "deselect"));
    • summary
  • dojox.grid.Selection.insert

    • type
      Function
    • parameters:
      • inIndex: (typeof )
    • source: [view]
        this.selected.splice(inIndex, 0, false);
        if(this.selectedIndex >= inIndex){
         this.selectedIndex++;
        }
    • summary
  • dojox.grid.Selection.remove

    • type
      Function
    • parameters:
      • inIndex: (typeof )
    • source: [view]
        this.selected.splice(inIndex, 1);
        if(this.selectedIndex >= inIndex){
         this.selectedIndex--;
        }
    • summary
  • dojox.grid.Selection.deselectAll

    • type
      Function
    • parameters:
      • inExcept: (typeof )
    • source: [view]
        for(var i in this.selected){
         if((i!=inExcept)&&(this.selected[i]===true)){
          this.deselect(i);
         }
        }
    • summary
  • dojox.grid.Selection.clickSelect

    • type
      Function
    • parameters:
      • inIndex: (typeof )
      • inCtrlKey: (typeof )
      • inShiftKey: (typeof )
    • source: [view]
        if(this.mode == 'none'){ return; }
        this._beginUpdate();
        if(this.mode != 'extended'){
         this.select(inIndex);
        }else{
         var lastSelected = this.selectedIndex;
         if(!inCtrlKey){
          this.deselectAll(inIndex);
         }
         if(inShiftKey){
          this.selectRange(lastSelected, inIndex);
         }else if(inCtrlKey){
          this.toggleSelect(inIndex);
         }else{
          this.addToSelection(inIndex);
         }
        }
        this._endUpdate();
    • summary
  • dojox.grid.Selection.clickSelectEvent

    • type
      Function
    • parameters:
      • e: (typeof )
    • source: [view]
        this.clickSelect(e.rowIndex, dojo.isCopyKey(e), e.shiftKey);
    • summary
  • dojox.grid.Selection.clear

    • type
      Function
    • source: [view]
        this._beginUpdate();
        this.deselectAll();
        this._endUpdate();
    • summary
  • dojox.grid.Selection.grid

    • summary
  • dojox.grid

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary