Skip to content

Commit

Permalink
Compare pinning menu item by name property.
Browse files Browse the repository at this point in the history
  • Loading branch information
cxr29 committed Nov 12, 2014
1 parent b984bae commit 642a8e4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/features/pinning/js/pinning.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
}

var pinColumnLeftAction = {
name: 'ui.grid.pinning.pinLeft',
title: i18nService.get().pinning.pinLeft,
icon: 'ui-grid-icon-left-open',
shown: function () {
Expand All @@ -143,6 +144,7 @@
};

var pinColumnRightAction = {
name: 'ui.grid.pinning.pinRight',
title: i18nService.get().pinning.pinRight,
icon: 'ui-grid-icon-right-open',
shown: function () {
Expand All @@ -164,6 +166,7 @@
};

var removePinAction = {
name: 'ui.grid.pinning.unpin',
title: i18nService.get().pinning.unpin,
icon: 'ui-grid-icon-cancel',
shown: function () {
Expand All @@ -181,13 +184,13 @@
}
};

if (!gridUtil.arrayContainsObjectWithProperty(col.menuItems, 'icon', 'ui-grid-icon-left-open')) {
if (!gridUtil.arrayContainsObjectWithProperty(col.menuItems, 'name', 'ui.grid.pinning.pinLeft')) {
col.menuItems.push(pinColumnLeftAction);
}
if (!gridUtil.arrayContainsObjectWithProperty(col.menuItems, 'icon', 'ui-grid-icon-right-open')) {
if (!gridUtil.arrayContainsObjectWithProperty(col.menuItems, 'name', 'ui.grid.pinning.pinRight')) {
col.menuItems.push(pinColumnRightAction);
}
if (!gridUtil.arrayContainsObjectWithProperty(col.menuItems, 'icon', 'ui-grid-icon-cancel')) {
if (!gridUtil.arrayContainsObjectWithProperty(col.menuItems, 'name', 'ui.grid.pinning.unpin')) {
col.menuItems.push(removePinAction);
}
}
Expand Down

0 comments on commit 642a8e4

Please sign in to comment.