Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(picker): column exclude from ColumnPicker, GridMenu caussing issue #402

Merged
merged 1 commit into from Jul 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions controls/slick.columnpicker.css
Expand Up @@ -44,3 +44,8 @@
.slick-columnpicker li a:hover {
background: white;
}

/* Excluded item from Column Picker will be hidden */
.slick-columnpicker-list li.hidden {
display: none;
}
17 changes: 5 additions & 12 deletions controls/slick.columnpicker.js
Expand Up @@ -32,6 +32,7 @@
var _grid = grid;
var _options = options;
var $columnTitleElm;
var columns;
var $list;
var $menu;
var columnCheckboxes;
Expand Down Expand Up @@ -97,9 +98,10 @@
columnCheckboxes = [];

var $li, $input;
var columnLabel;
var columnLabel, excludeCssClass;
for (var i = 0; i < columns.length; i++) {
$li = $("<li />").appendTo($list);
excludeCssClass = columns[i].excludeFromColumnPicker ? "hidden" : "";
$li = $('<li class="' + excludeCssClass + '" />').appendTo($list);
$input = $("<input type='checkbox' />").data("column-id", columns[i].id);
columnCheckboxes.push($input);

Expand Down Expand Up @@ -177,16 +179,7 @@
ordered[i] = current.shift();
}
}

// filter out excluded column header when necessary
// (works with IE9+, older browser requires a polyfill for the filter to work, visit MDN for more info)
if (Array.isArray(ordered) && typeof ordered.filter === 'function') {
columns = ordered.filter(function (columnDef) {
return !columnDef.excludeFromColumnPicker;
});
} else {
columns = ordered;
}
columns = ordered;
}

/** Update the Titles of each sections (command, customTitle, ...) */
Expand Down
6 changes: 5 additions & 1 deletion controls/slick.gridmenu.css
Expand Up @@ -106,12 +106,16 @@
vertical-align: middle;
}


/* Disabled */
.slick-gridmenu-item-disabled {
color: silver;
}

/* Excluded item from Grid Menu will be hidden */
.slick-gridmenu-list li.hidden {
display: none;
}

/* Divider */
.slick-gridmenu-item.slick-gridmenu-item-divider {
cursor: default;
Expand Down
18 changes: 6 additions & 12 deletions controls/slick.gridmenu.js
Expand Up @@ -105,6 +105,7 @@
var $list;
var $button;
var $menu;
var columns;
var columnCheckboxes;
var _defaults = {
hideForceFitButton: false,
Expand Down Expand Up @@ -262,9 +263,11 @@
}
}

var $li, $input;
var $li, $input, excludeCssClass;
for (var i = 0; i < columns.length; i++) {
$li = $("<li />").appendTo($list);
excludeCssClass = columns[i].excludeFromGridMenu ? "hidden" : "";
$li = $('<li class="' + excludeCssClass + '" />').appendTo($list);

$input = $("<input type='checkbox' />").data("column-id", columns[i].id);
columnCheckboxes.push($input);

Expand Down Expand Up @@ -395,16 +398,7 @@
ordered[i] = current.shift();
}
}

// filter out excluded column header when necessary
// (works with IE9+, older browser requires a polyfill for the filter to work, visit MDN for more info)
if (Array.isArray(ordered) && typeof ordered.filter === 'function') {
columns = ordered.filter(function (columnDef) {
return !columnDef.excludeFromGridMenu;
});
} else {
columns = ordered;
}
columns = ordered;
}

function updateColumn(e) {
Expand Down