this.displayColumns = {};
// {index => true} map of selected rows
- this.selectedRows = {};
+ this.selected = {};
this.indexValue = function(item) {
if (this.indexFieldAsFunction) {
angular.forEach(
this.items,
function(item) {
- if (self.selectedRows[self.indexValue(item)])
+ if (self.selected[self.indexValue(item)])
items.push(item);
}
);
if (self.indexValue(item) == index)
self.items.splice(idx, 1);
});
- delete this.selectedRows[index];
+ delete this.selected[index];
}
this.count = function() { return this.items.length }
this.offset = 0;
this.totalCount = 0;
this.items = [];
- this.selectedRows = {};
+ this.selected = {};
}
// prepare to draw a new page of data
this.resetPageData = function() {
this.items = [];
- this.selectedRows = {};
+ this.selected = {};
}
this.showAllColumns = function() {
}
// selects one row after deselecting all of the others
- this.selectOneRow = function(index) {
- this.deselectAllRows();
- this.selectedRows[index] = true;
+ this.selectOne = function(index) {
+ this.deselectAll();
+ this.selected[index] = true;
}
// selects or deselects a row, without affecting the others
- this.toggleOneRowSelection = function(index) {
- if (this.selectedRows[index]) {
- delete this.selectedRows[index];
+ this.toggleOneSelection = function(index) {
+ if (this.selected[index]) {
+ delete this.selected[index];
} else {
- this.selectedRows[index] = true;
+ this.selected[index] = true;
}
}
// selects all visible rows
- this.selectAllRows = function() {
+ this.selectAll = function() {
angular.forEach(this.items, function(item) {
- self.selectedRows[self.indexValue(item)] = true
+ self.selected[self.indexValue(item)] = true
});
}
// if all are selected, deselect all, otherwise select all
this.toggleSelectAll = function() {
- if (Object.keys(this.selectedRows).length == this.items.length) {
- this.deselectAllRows();
+ if (Object.keys(this.selected).length == this.items.length) {
+ this.deselectAll();
} else {
- this.selectAllRows();
+ this.selectAll();
}
}
// deselects all visible rows
- this.deselectAllRows = function() {
- this.selectedRows = {};
+ this.deselectAll = function() {
+ this.selected = {};
}
this.defaultColumns = function(list) {