/*** * A control to add a Column Picker (right+click on any column header to reveal the column picker) * * USAGE: * * Add the slick.columnpicker.(js|css) files and register it with the grid. * * Available options, by defining a columnPicker object: * * var options = { * enableCellNavigation: true, * columnPicker: { * columnTitle: "Columns", // default to empty string * * // the last 2 checkboxes titles * hideForceFitButton: false, // show/hide checkbox near the end "Force Fit Columns" (default:false) * hideSyncResizeButton: false, // show/hide checkbox near the end "Synchronous Resize" (default:false) * forceFitTitle: "Force fit columns", // default to "Force fit columns" * headerColumnValueExtractor: "Extract the column label" // default to column.name * syncResizeTitle: "Synchronous resize", // default to "Synchronous resize" * } * }; * * @class Slick.Controls.ColumnPicker * @constructor */ 'use strict'; (function ($) { function SlickColumnPicker(columns, grid, options) { var _grid = grid; var _options = options; var $list; var $menu; var columnCheckboxes; var onColumnsChanged = new Slick.Event(); var defaults = { fadeSpeed: 250, // the last 2 checkboxes titles hideForceFitButton: false, hideSyncResizeButton: false, forceFitTitle: "Force fit columns", syncResizeTitle: "Synchronous resize", headerColumnValueExtractor: function (columnDef) { return columnDef.name; } }; function init(grid) { grid.onHeaderContextMenu.subscribe(handleHeaderContextMenu); grid.onColumnsReordered.subscribe(updateColumnOrder); _options = $.extend({}, defaults, options); $menu = $("