slickgrid
Advanced tools
Comparing version 2.3.19 to 2.3.20
@@ -31,2 +31,3 @@ /*** | ||
function SlickColumnPicker(columns, grid, options) { | ||
var _grid = grid; | ||
var $list; | ||
@@ -47,3 +48,3 @@ var $menu; | ||
function init() { | ||
function init(grid) { | ||
grid.onHeaderContextMenu.subscribe(handleHeaderContextMenu); | ||
@@ -74,4 +75,4 @@ grid.onColumnsReordered.subscribe(updateColumnOrder); | ||
function destroy() { | ||
grid.onHeaderContextMenu.unsubscribe(handleHeaderContextMenu); | ||
grid.onColumnsReordered.unsubscribe(updateColumnOrder); | ||
_grid.onHeaderContextMenu.unsubscribe(handleHeaderContextMenu); | ||
_grid.onColumnsReordered.unsubscribe(updateColumnOrder); | ||
$(document.body).off("mousedown", handleBodyMouseDown); | ||
@@ -100,3 +101,3 @@ $("div.slick-columnpicker").hide(options.fadeSpeed); | ||
if (grid.getColumnIndex(columns[i].id) != null) { | ||
if (_grid.getColumnIndex(columns[i].id) != null) { | ||
$input.attr("checked", "checked"); | ||
@@ -123,3 +124,3 @@ } | ||
.appendTo($li); | ||
if (grid.getOptions().forceFitColumns) { | ||
if (_grid.getOptions().forceFitColumns) { | ||
$input.attr("checked", "checked"); | ||
@@ -137,3 +138,3 @@ } | ||
.appendTo($li); | ||
if (grid.getOptions().syncColumnCellResize) { | ||
if (_grid.getOptions().syncColumnCellResize) { | ||
$input.attr("checked", "checked"); | ||
@@ -159,6 +160,6 @@ } | ||
// of the current column sort. | ||
var current = grid.getColumns().slice(0); | ||
var current = _grid.getColumns().slice(0); | ||
var ordered = new Array(columns.length); | ||
for (var i = 0; i < ordered.length; i++) { | ||
if ( grid.getColumnIndex(columns[i].id) === undefined ) { | ||
if ( _grid.getColumnIndex(columns[i].id) === undefined ) { | ||
// If the column doesn't return a value from getColumnIndex, | ||
@@ -178,6 +179,6 @@ // it is hidden. Leave it in this position. | ||
if (e.target.checked) { | ||
grid.setOptions({forceFitColumns:true}); | ||
grid.autosizeColumns(); | ||
_grid.setOptions({forceFitColumns:true}); | ||
_grid.autosizeColumns(); | ||
} else { | ||
grid.setOptions({forceFitColumns:false}); | ||
_grid.setOptions({forceFitColumns:false}); | ||
} | ||
@@ -189,5 +190,5 @@ return; | ||
if (e.target.checked) { | ||
grid.setOptions({syncColumnCellResize:true}); | ||
_grid.setOptions({syncColumnCellResize:true}); | ||
} else { | ||
grid.setOptions({syncColumnCellResize:false}); | ||
_grid.setOptions({syncColumnCellResize:false}); | ||
} | ||
@@ -210,4 +211,4 @@ return; | ||
grid.setColumns(visibleColumns); | ||
onColumnsChanged.notify({columns: visibleColumns, grid: grid}); | ||
_grid.setColumns(visibleColumns); | ||
onColumnsChanged.notify({columns: visibleColumns, grid: _grid}); | ||
} | ||
@@ -220,5 +221,6 @@ } | ||
init(); | ||
init(_grid); | ||
return { | ||
"init": init, | ||
"getAllColumns": getAllColumns, | ||
@@ -225,0 +227,0 @@ "destroy": destroy, |
{ | ||
"name": "slickgrid", | ||
"version": "2.3.19", | ||
"version": "2.3.20", | ||
"description": "A lightning fast JavaScript grid/spreadsheet", | ||
@@ -5,0 +5,0 @@ "main": "slick.core.js", |
@@ -18,5 +18,7 @@ (function ($) { | ||
cssClass: null, | ||
hideSelectAllCheckbox: false, | ||
toolTip: "Select/Deselect All", | ||
width: 30 | ||
}; | ||
var _isSelectAllChecked = false; | ||
@@ -38,2 +40,20 @@ var _options = $.extend(true, {}, _defaults, options); | ||
function getOptions(options) { | ||
return _options; | ||
} | ||
function setOptions(options) { | ||
_options = $.extend(true, {}, _options, options); | ||
if (_options.hideSelectAllCheckbox) { | ||
_grid.updateColumnHeader(_options.columnId, "", ""); | ||
} else { | ||
var UID = createUID(); | ||
if (_isSelectAllChecked) { | ||
_grid.updateColumnHeader(_options.columnId, "<input id='header-selector" + UID + "' type='checkbox' checked='checked'><label for='header-selector" + UID + "'></label>", _options.toolTip); | ||
} else { | ||
_grid.updateColumnHeader(_options.columnId, "<input id='header-selector" + UID + "' type='checkbox'><label for='header-selector" + UID + "'></label>", _options.toolTip); | ||
} | ||
} | ||
} | ||
function handleSelectedRowsChanged(e, args) { | ||
@@ -56,7 +76,10 @@ var UID = createUID(); | ||
_grid.render(); | ||
_isSelectAllChecked = selectedRows.length && selectedRows.length == _grid.getDataLength(); | ||
if (selectedRows.length && selectedRows.length == _grid.getDataLength()) { | ||
_grid.updateColumnHeader(_options.columnId, "<input id='header-selector" + UID + "' type='checkbox' checked='checked'><label for='header-selector" + UID + "'></label>", _options.toolTip); | ||
} else { | ||
_grid.updateColumnHeader(_options.columnId, "<input id='header-selector" + UID + "' type='checkbox'><label for='header-selector" + UID + "'></label>", _options.toolTip); | ||
if (!_options.hideSelectAllCheckbox) { | ||
if (_isSelectAllChecked) { | ||
_grid.updateColumnHeader(_options.columnId, "<input id='header-selector" + UID + "' type='checkbox' checked='checked'><label for='header-selector" + UID + "'></label>", _options.toolTip); | ||
} else { | ||
_grid.updateColumnHeader(_options.columnId, "<input id='header-selector" + UID + "' type='checkbox'><label for='header-selector" + UID + "'></label>", _options.toolTip); | ||
} | ||
} | ||
@@ -171,3 +194,3 @@ } | ||
id: _options.columnId, | ||
name: "<input id='header-selector" + UID + "' type='checkbox'><label for='header-selector" + UID + "'></label>", | ||
name: _options.hideSelectAllCheckbox ? "" : "<input id='header-selector" + UID + "' type='checkbox'><label for='header-selector" + UID + "'></label>", | ||
toolTip: _options.toolTip, | ||
@@ -179,2 +202,3 @@ field: "sel", | ||
cssClass: _options.cssClass, | ||
hideSelectAllCheckbox: _options.hideSelectAllCheckbox, | ||
formatter: checkboxSelectionFormatter | ||
@@ -204,5 +228,7 @@ }; | ||
"selectRows": selectRows, | ||
"getColumnDefinition": getColumnDefinition | ||
"getColumnDefinition": getColumnDefinition, | ||
"getOptions": getOptions, | ||
"setOptions": setOptions, | ||
}); | ||
} | ||
})(jQuery); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4808380
91338