You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cacert-testmgr/external/ZendFramework-1.9.5/externals/dojo/dojox/grid/DataSelection.js

66 lines
1.7 KiB
JavaScript

dojo.provide("dojox.grid.DataSelection");
dojo.require("dojox.grid.Selection");
dojo.declare("dojox.grid.DataSelection", dojox.grid.Selection, {
getFirstSelected: function(){
var idx = dojox.grid.Selection.prototype.getFirstSelected.call(this);
if(idx == -1){ return null; }
return this.grid.getItem(idx);
},
getNextSelected: function(inPrev){
var old_idx = this.grid.getItemIndex(inPrev);
var idx = dojox.grid.Selection.prototype.getNextSelected.call(this, old_idx);
if(idx == -1){ return null; }
return this.grid.getItem(idx);
},
getSelected: function(){
var result = [];
for(var i=0, l=this.selected.length; i<l; i++){
if(this.selected[i]){
result.push(this.grid.getItem(i));
}
}
return result;
},
addToSelection: function(inItemOrIndex){
if(this.mode == 'none'){ return; }
var idx = null;
if(typeof inItemOrIndex == "number" || typeof inItemOrIndex == "string"){
idx = inItemOrIndex;
}else{
idx = this.grid.getItemIndex(inItemOrIndex);
}
dojox.grid.Selection.prototype.addToSelection.call(this, idx);
},
deselect: function(inItemOrIndex){
if(this.mode == 'none'){ return; }
var idx = null;
if(typeof inItemOrIndex == "number" || typeof inItemOrIndex == "string"){
idx = inItemOrIndex;
}else{
idx = this.grid.getItemIndex(inItemOrIndex);
}
dojox.grid.Selection.prototype.deselect.call(this, idx);
},
deselectAll: function(inItemOrIndex){
var idx = null;
if(inItemOrIndex || typeof inItemOrIndex == "number"){
if(typeof inItemOrIndex == "number" || typeof inItemOrIndex == "string"){
idx = inItemOrIndex;
}else{
idx = this.grid.getItemIndex(inItemOrIndex);
}
dojox.grid.Selection.prototype.deselectAll.call(this, idx);
}else{
this.inherited(arguments);
}
}
});