root / trunk / web / dojo / dojox / grid / DataSelection.js @ 9
History | View | Annotate | Download (1.61 KB)
| 1 | 9 | andrej.cim | /*
|
|---|---|---|---|
| 2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
| 3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
| 4 | see: http://dojotoolkit.org/license for details
|
||
| 5 | */
|
||
| 6 | |||
| 7 | |||
| 8 | if(!dojo._hasResource["dojox.grid.DataSelection"]){ |
||
| 9 | dojo._hasResource["dojox.grid.DataSelection"]=true; |
||
| 10 | dojo.provide("dojox.grid.DataSelection");
|
||
| 11 | dojo.require("dojox.grid.Selection");
|
||
| 12 | dojo.declare("dojox.grid.DataSelection",dojox.grid.Selection,{getFirstSelected:function(){ |
||
| 13 | var _1=dojox.grid.Selection.prototype.getFirstSelected.call(this); |
||
| 14 | if(_1==-1){ |
||
| 15 | return null; |
||
| 16 | } |
||
| 17 | return this.grid.getItem(_1); |
||
| 18 | },getNextSelected:function(_2){ |
||
| 19 | var _3=this.grid.getItemIndex(_2); |
||
| 20 | var _4=dojox.grid.Selection.prototype.getNextSelected.call(this,_3); |
||
| 21 | if(_4==-1){ |
||
| 22 | return null; |
||
| 23 | } |
||
| 24 | return this.grid.getItem(_4); |
||
| 25 | },getSelected:function(){ |
||
| 26 | var _5=[];
|
||
| 27 | for(var i=0,l=this.selected.length;i<l;i++){ |
||
| 28 | if(this.selected[i]){ |
||
| 29 | _5.push(this.grid.getItem(i));
|
||
| 30 | } |
||
| 31 | } |
||
| 32 | return _5;
|
||
| 33 | },addToSelection:function(_6){ |
||
| 34 | if(this.mode=="none"){ |
||
| 35 | return;
|
||
| 36 | } |
||
| 37 | var _7=null; |
||
| 38 | if(typeof _6=="number"||typeof _6=="string"){ |
||
| 39 | _7=_6; |
||
| 40 | }else{
|
||
| 41 | _7=this.grid.getItemIndex(_6);
|
||
| 42 | } |
||
| 43 | dojox.grid.Selection.prototype.addToSelection.call(this,_7);
|
||
| 44 | },deselect:function(_8){ |
||
| 45 | if(this.mode=="none"){ |
||
| 46 | return;
|
||
| 47 | } |
||
| 48 | var _9=null; |
||
| 49 | if(typeof _8=="number"||typeof _8=="string"){ |
||
| 50 | _9=_8; |
||
| 51 | }else{
|
||
| 52 | _9=this.grid.getItemIndex(_8);
|
||
| 53 | } |
||
| 54 | dojox.grid.Selection.prototype.deselect.call(this,_9);
|
||
| 55 | },deselectAll:function(_a){ |
||
| 56 | var _b=null; |
||
| 57 | if(_a||typeof _a=="number"){ |
||
| 58 | if(typeof _a=="number"||typeof _a=="string"){ |
||
| 59 | _b=_a; |
||
| 60 | }else{
|
||
| 61 | _b=this.grid.getItemIndex(_a);
|
||
| 62 | } |
||
| 63 | dojox.grid.Selection.prototype.deselectAll.call(this,_b);
|
||
| 64 | }else{
|
||
| 65 | this.inherited(arguments); |
||
| 66 | } |
||
| 67 | }}); |
||
| 68 | } |