Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
base repository: angular-ui/ui-grid
Choose a Base Repository
angular-ui/ui-grid
Aardvark71/ng-grid
AdelinGhanaem/ng-grid
AlasdairSwan/ng-grid
AntonFend/ng-grid
CNXTEoEorg/ui-grid
Dashue/ng-grid
Donderda/ng-grid
EricEngineered/ng-grid
EugeneBorshch/ng-grid
EugeneTruly/ng-grid
GenesysPureConnect/ng-grid
Jammasternam/ng-grid
JavaBasketball/ui-grid
Jenk-Rendar/ng-grid
JonahKE/ui-grid
KNaved/ui-grid
Klarence/ng-grid
Martin17/ng-grid
Mistobaan/ng-grid
Moreface/ng-grid
Pasha-Pramati/ng-grid
Premier/ng-grid
Reskov/ng-grid
SummerDejavu/ng-grid
UrvilKaswala/ng-grid
Wiinis/ng-grid
YonatanKra/ui-grid
a5sk4s/ng-grid
aaks2010/ng-grid
akhileshappala/ui-grid
alecswan/ng-grid
alexspurling/ng-grid
alpinegizmo/ng-grid
anuradha18/ng-grid
archsh/ng-grid
ata-n/ng-grid
avgalon/ng-grid
avikaco/ng-grid
ballmw/ng-grid
bbradbury/ng-grid
benjaminkitt/ng-grid
benmj/ng-grid
blackneus/ng-grid
bmleite/ng-grid
boland/ng-grid
bpoussin/ng-grid
bradlund/ng-grid
bundance/ng-grid
caphun/ng-grid
ccreed2/ui-grid
cdesogeti/ng-grid
ceolter/ui-grid
chanu587/ng-grid
chinnurtb/ng-grid
chiragchamoli/ng-grid
choroshin/ng-grid
christoffee/ng-grid
clkao/ng-grid
cxl55/ng-grid
daclubb/ng-grid
darkhorse-dev/ui-grid
darknos/ng-grid
dcolens/ng-grid
dean-me/ng-grid
demon-lord/ng-grid
devony/ng-grid
doctorsender/ng-grid
ebraminio/ng-grid
ezecafre89/ng-grid
felixhummel/ng-grid
firmusoft/ng-grid
francescoagati/ng-grid
frogomatic/ng-grid
garaboncias/ng-grid
getuliojr/ng-grid
giosakti/ng-grid
goldhand/ng-grid
goodluck2016/ui-grid
hawtio/ng-grid
hey24sheep/ui-grid
hoshidaniel/ng-grid
hotings/ng-grid
hucarrot/ng-grid
imloama/ng-grid
ineedfat/ng-grid
is-fredrik/ng-grid
ismakv/ui-grid
itxd/ui-grid
jeado/ng-grid
jeanpuga/ui-grid
jeffbcross/ng-grid
jeffslofish/ng-grid
jessegavin/ng-grid
jfzman/ng-grid
jharohit/ng-grid
jiacomino/ng-grid
jimhotchkin-wf/ng-grid
jimmytheneutrino/ng-grid
jmaynier/ng-grid
johlrich/ng-grid
johnobe/ng-grid
johnparn/ng-grid
jon23cooper/ng-grid
jozzhart/ng-grid
jspeshu/ng-grid
jstrachan/ng-grid
juliofreitas/ui-grid
jurby/ng-grid
karnyj/ng-grid
keathley/ng-grid
keithharvey/ng-grid
kmussel/ng-grid
koen-serry/ng-grid
konrad-garus/ng-grid
krahman/ng-grid
ksmoore/ng-grid
kugel-soft/ui-grid
lebedevsergey/ui-grid-fix-issue-with-pinned-columns-in-v2
leninloganathan/ui-grid
liergouzi/ui-grid
loiphamvn/ng-grid
longFeiLi/ui-grid
marciosartini/ng-grid
marklagendijk/ng-grid
martijnve/ng-grid
mathiasdose/ng-grid
mathieurivest/ng-grid
matpaprocki/ng-grid
mattlaver/ng-grid
maxcan/ng-grid
mchapman/ng-grid
mediaprojects/ng-grid
mgibson/ng-grid
mheye/ng-grid
mmatczak/ui-grid
mschroering/ng-grid
musically-ut/ng-grid
mxreppy/ng-grid
niilante/ui-grid
nishant8BITS/ng-grid
noming/ng-grid
nuclearghost/ng-grid
orneryd/ng-grid
owenXin/ng-grid
pdegenhardt/ng-grid
pdemanget/ng-grid
ppollono/ng-grid
prabhat2233/ui-grid
presidento/ng-grid
r7lemieux/ng-grid
richiepreece/ng-grid
ronbuchanan/ng-grid
sagarwasule/ng-grid
sapronlee/ng-grid
satyanand/ng-grid
sax1johno/ui-grid
seankenny/ng-grid
simonengelhardt/ng-grid
simplyjames/ng-grid
skusunam/ng-grid
snapappointments/ui-grid
sofibraun/ng-grid
solvebio/ng-grid
songguang-2010/ng-grid
sonicparke/ng-grid
sourcec0de/ng-grid
sravanthipoujula/ng-grid
sskyy/ng-grid
stan-z/ng-grid
strider820/ng-grid
sunfirefox/ng-grid
surfer26th/ng-grid
suryasingh/ng-grid
swalters/ng-grid
tcrimi/ng-grid
tetralon/ng-grid
thedarkjester/ng-grid
tjosbon/ng-grid
tkhemani/ng-grid
tradingscreen/ng-grid
tuckerjt07/ui-grid
turn/ng-grid
uapui-dev/ng-grid
vargose/ng-grid
vladovidiu/ng-grid
wdmny/ng-grid
wp-ng/ui-grid
xordad/ng-grid
xtidt/ui-grid
xtreme-christophe/ng-grid
yangsong158/ui-grid
yanl/ng-grid
yarl/ng-grid
yesnault/ng-grid
yunmanger1/ng-grid
zelingo/ui-grid
zhangdiwaa/ng-grid
zhanghaihua/ng-grid
ztp130213/ng-grid
Nothing to show
base: 0b25c788a92a
head repository: angular-ui/ui-grid
Choose a Head Repository
angular-ui/ui-grid
Aardvark71/ng-grid
AdelinGhanaem/ng-grid
AlasdairSwan/ng-grid
AntonFend/ng-grid
CNXTEoEorg/ui-grid
Dashue/ng-grid
Donderda/ng-grid
EricEngineered/ng-grid
EugeneBorshch/ng-grid
EugeneTruly/ng-grid
GenesysPureConnect/ng-grid
Jammasternam/ng-grid
JavaBasketball/ui-grid
Jenk-Rendar/ng-grid
JonahKE/ui-grid
KNaved/ui-grid
Klarence/ng-grid
Martin17/ng-grid
Mistobaan/ng-grid
Moreface/ng-grid
Pasha-Pramati/ng-grid
Premier/ng-grid
Reskov/ng-grid
SummerDejavu/ng-grid
UrvilKaswala/ng-grid
Wiinis/ng-grid
YonatanKra/ui-grid
a5sk4s/ng-grid
aaks2010/ng-grid
akhileshappala/ui-grid
alecswan/ng-grid
alexspurling/ng-grid
alpinegizmo/ng-grid
anuradha18/ng-grid
archsh/ng-grid
ata-n/ng-grid
avgalon/ng-grid
avikaco/ng-grid
ballmw/ng-grid
bbradbury/ng-grid
benjaminkitt/ng-grid
benmj/ng-grid
blackneus/ng-grid
bmleite/ng-grid
boland/ng-grid
bpoussin/ng-grid
bradlund/ng-grid
bundance/ng-grid
caphun/ng-grid
ccreed2/ui-grid
cdesogeti/ng-grid
ceolter/ui-grid
chanu587/ng-grid
chinnurtb/ng-grid
chiragchamoli/ng-grid
choroshin/ng-grid
christoffee/ng-grid
clkao/ng-grid
cxl55/ng-grid
daclubb/ng-grid
darkhorse-dev/ui-grid
darknos/ng-grid
dcolens/ng-grid
dean-me/ng-grid
demon-lord/ng-grid
devony/ng-grid
doctorsender/ng-grid
ebraminio/ng-grid
ezecafre89/ng-grid
felixhummel/ng-grid
firmusoft/ng-grid
francescoagati/ng-grid
frogomatic/ng-grid
garaboncias/ng-grid
getuliojr/ng-grid
giosakti/ng-grid
goldhand/ng-grid
goodluck2016/ui-grid
hawtio/ng-grid
hey24sheep/ui-grid
hoshidaniel/ng-grid
hotings/ng-grid
hucarrot/ng-grid
imloama/ng-grid
ineedfat/ng-grid
is-fredrik/ng-grid
ismakv/ui-grid
itxd/ui-grid
jeado/ng-grid
jeanpuga/ui-grid
jeffbcross/ng-grid
jeffslofish/ng-grid
jessegavin/ng-grid
jfzman/ng-grid
jharohit/ng-grid
jiacomino/ng-grid
jimhotchkin-wf/ng-grid
jimmytheneutrino/ng-grid
jmaynier/ng-grid
johlrich/ng-grid
johnobe/ng-grid
johnparn/ng-grid
jon23cooper/ng-grid
jozzhart/ng-grid
jspeshu/ng-grid
jstrachan/ng-grid
juliofreitas/ui-grid
jurby/ng-grid
karnyj/ng-grid
keathley/ng-grid
keithharvey/ng-grid
kmussel/ng-grid
koen-serry/ng-grid
konrad-garus/ng-grid
krahman/ng-grid
ksmoore/ng-grid
kugel-soft/ui-grid
lebedevsergey/ui-grid-fix-issue-with-pinned-columns-in-v2
leninloganathan/ui-grid
liergouzi/ui-grid
loiphamvn/ng-grid
longFeiLi/ui-grid
marciosartini/ng-grid
marklagendijk/ng-grid
martijnve/ng-grid
mathiasdose/ng-grid
mathieurivest/ng-grid
matpaprocki/ng-grid
mattlaver/ng-grid
maxcan/ng-grid
mchapman/ng-grid
mediaprojects/ng-grid
mgibson/ng-grid
mheye/ng-grid
mmatczak/ui-grid
mschroering/ng-grid
musically-ut/ng-grid
mxreppy/ng-grid
niilante/ui-grid
nishant8BITS/ng-grid
noming/ng-grid
nuclearghost/ng-grid
orneryd/ng-grid
owenXin/ng-grid
pdegenhardt/ng-grid
pdemanget/ng-grid
ppollono/ng-grid
prabhat2233/ui-grid
presidento/ng-grid
r7lemieux/ng-grid
richiepreece/ng-grid
ronbuchanan/ng-grid
sagarwasule/ng-grid
sapronlee/ng-grid
satyanand/ng-grid
sax1johno/ui-grid
seankenny/ng-grid
simonengelhardt/ng-grid
simplyjames/ng-grid
skusunam/ng-grid
snapappointments/ui-grid
sofibraun/ng-grid
solvebio/ng-grid
songguang-2010/ng-grid
sonicparke/ng-grid
sourcec0de/ng-grid
sravanthipoujula/ng-grid
sskyy/ng-grid
stan-z/ng-grid
strider820/ng-grid
sunfirefox/ng-grid
surfer26th/ng-grid
suryasingh/ng-grid
swalters/ng-grid
tcrimi/ng-grid
tetralon/ng-grid
thedarkjester/ng-grid
tjosbon/ng-grid
tkhemani/ng-grid
tradingscreen/ng-grid
tuckerjt07/ui-grid
turn/ng-grid
uapui-dev/ng-grid
vargose/ng-grid
vladovidiu/ng-grid
wdmny/ng-grid
wp-ng/ui-grid
xordad/ng-grid
xtidt/ui-grid
xtreme-christophe/ng-grid
yangsong158/ui-grid
yanl/ng-grid
yarl/ng-grid
yesnault/ng-grid
yunmanger1/ng-grid
zelingo/ui-grid
zhangdiwaa/ng-grid
zhanghaihua/ng-grid
ztp130213/ng-grid
Nothing to show
compare: f5d49219a54f
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 2 contributors
Commits on Dec 27, 2014
Enh(selection) #2453: enableSelection at gridRow level
Showing with 55 additions and 7 deletions.
  1. +24 −7 src/features/selection/js/selection.js
  2. +31 −0 src/features/selection/test/uiGridSelectionService.spec.js
@@ -93,7 +93,7 @@
*/
toggleRowSelection: function (rowEntity, evt) {
var row = grid.getRow(rowEntity);
if (row !== null) {
if (row !== null && row.enableSelection !== false) {
service.toggleRowSelection(grid, row, evt, grid.options.multiSelect, grid.options.noUnselect);
}
},
@@ -107,7 +107,7 @@
*/
selectRow: function (rowEntity, evt) {
var row = grid.getRow(rowEntity);
if (row !== null && !row.isSelected) {
if (row !== null && !row.isSelected && row.enableSelection !== false) {
service.toggleRowSelection(grid, row, evt, grid.options.multiSelect, grid.options.noUnselect);
}
},
@@ -124,7 +124,7 @@
*/
selectRowByVisibleIndex: function ( rowNum, evt ) {
var row = grid.renderContainers.body.visibleRowCache[rowNum];
if (row !== null && typeof(row) !== 'undefined' && !row.isSelected) {
if (row !== null && typeof(row) !== 'undefined' && !row.isSelected && row.enableSelection !== false) {
service.toggleRowSelection(grid, row, evt, grid.options.multiSelect, grid.options.noUnselect);
}
},
@@ -156,7 +156,7 @@

var changedRows = [];
grid.rows.forEach(function (row) {
if ( !row.isSelected ){
if ( !row.isSelected && row.enableSelection !== false ){
row.isSelected = true;
service.decideRaiseSelectionEvent( grid, row, changedRows, evt );
}
@@ -179,7 +179,7 @@
var changedRows = [];
grid.rows.forEach(function (row) {
if (row.visible) {
if (!row.isSelected){
if (!row.isSelected && row.enableSelection !== false){
row.isSelected = true;
service.decideRaiseSelectionEvent( grid, row, changedRows, evt );
}
@@ -276,6 +276,23 @@
* set using the ui-grid {@link ui.grid.class:GridOptions gridOptions}
*/

/**
* @ngdoc object
* @name ui.grid.selection.api:GridRow
*
* @description GridRow options for selection feature
*/
/**
* @ngdoc object
* @name enableSelection
* @propertyOf ui.grid.selection.api:GridRow
* @description Enable row selection for this row, only settable by internal code.
*
* The grouping feature, for example, might set group header rows to not be selectable.
* <br/>Defaults to true
*/


/**
* @ngdoc object
* @name enableRowSelection
@@ -374,7 +391,7 @@

if (selected && noUnselect){
// don't deselect the row
} else {
} else if (row.enableSelection !== false) {
row.isSelected = !selected;
if (row.isSelected === true) {
grid.selection.lastSelectedRow = row;
@@ -412,7 +429,7 @@
for (var i = fromRow; i <= toRow; i++) {
var rowToSelect = grid.renderContainers.body.visibleRowCache[i];
if (rowToSelect) {
if ( !rowToSelect.isSelected ){
if ( !rowToSelect.isSelected && rowToSelect.enableSelection !== false ){
rowToSelect.isSelected = true;
grid.selection.lastSelectedRow = rowToSelect;
service.decideRaiseSelectionEvent( grid, rowToSelect, changedRows, evt );
@@ -52,6 +52,12 @@ describe('ui.grid.selection uiGridSelectionService', function () {
expect(grid.rows[1].isSelected).toBe(true);
});

it('should not toggle selected with enableSelection: false', function () {
grid.rows[0].enableSelection = false;
uiGridSelectionService.toggleRowSelection(grid, grid.rows[0], null, true);
expect(grid.rows[0].isSelected).toBe(undefined);
});

it('should toggle selected with noUnselect', function () {
uiGridSelectionService.toggleRowSelection(grid, grid.rows[0], null, false, true);
expect(grid.rows[0].isSelected).toBe(true, 'row should be selected, noUnselect doesn\'t stop rows being selected');
@@ -104,6 +110,16 @@ describe('ui.grid.selection uiGridSelectionService', function () {
expect(grid.rows[5].isSelected).toBe(true);
});

it('should skip non-selectable rows', function () {
grid.rows[4].enableSelection = false;
grid.api.selection.toggleRowSelection(grid.rows[2].entity);
uiGridSelectionService.shiftSelect(grid, grid.rows[5], null, true);
expect(grid.rows[2].isSelected).toBe(true);
expect(grid.rows[3].isSelected).toBe(true);
expect(grid.rows[4].isSelected).toBe(undefined);
expect(grid.rows[5].isSelected).toBe(true);
});

it('should reverse selection order if from is bigger then to', function () {
grid.api.selection.toggleRowSelection(grid.rows[5].entity);
uiGridSelectionService.shiftSelect(grid, grid.rows[2], null, true);
@@ -143,6 +159,10 @@ describe('ui.grid.selection uiGridSelectionService', function () {
grid.api.selection.unSelectRow(grid.rows[6].entity);
expect(grid.rows[4].isSelected).toBe(false);
expect(grid.rows[6].isSelected).toBe(false);

grid.rows[4].enableSelection = false;
grid.api.selection.selectRow(grid.rows[4].entity);
expect(grid.rows[4].isSelected).toBe(false);
});
});

@@ -174,6 +194,11 @@ describe('ui.grid.selection uiGridSelectionService', function () {
expect(grid.rows[i].isSelected).toBe(false);
}
expect(grid.selection.selectAll).toBe(false);

grid.rows[8].enableSelection = false;
grid.api.selection.selectAllRows();
expect(grid.rows[7].isSelected).toBe(true);
expect(grid.rows[8].isSelected).toBe(false);
});
});

@@ -203,6 +228,7 @@ describe('ui.grid.selection uiGridSelectionService', function () {
grid.rows[4].visible = true;
grid.rows[6].visible = false;
grid.rows[7].visible = true;
grid.rows[8].enableSelection = false;
grid.rows[9].visible = true;
expect(grid.selection.selectAll).toBe(false);

@@ -211,6 +237,7 @@ describe('ui.grid.selection uiGridSelectionService', function () {
expect(grid.rows[4].isSelected).toBe(true);
expect(grid.rows[6].isSelected).toBe(false);
expect(grid.rows[7].isSelected).toBe(true);
expect(grid.rows[8].isSelected).toBe(undefined);
expect(grid.rows[9].isSelected).toBe(true);
expect(grid.selection.selectAll).toBe(true);
});
@@ -226,6 +253,10 @@ describe('ui.grid.selection uiGridSelectionService', function () {

grid.api.selection.selectRowByVisibleIndex(1);
expect(grid.rows[2].isSelected).toBe(true);

grid.rows[3].enableSelection = false;
grid.api.selection.selectRowByVisibleIndex(2);
expect(grid.rows[3].isSelected).toBe(undefined);
});
});

No commit comments for this range

You can’t perform that action at this time.