slickgrid
Advanced tools
Comparing version 2.3.10 to 2.3.12
@@ -0,1 +1,25 @@ | ||
/*** | ||
* 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 | ||
* forceFitTitle: "Force fit columns", // default to "Force fit columns" | ||
* syncResizeTitle: "Synchronous resize", // default to "Synchronous resize" | ||
* } | ||
* }; | ||
* | ||
* @class Slick.Controls.ColumnPicker | ||
* @constructor | ||
*/ | ||
'use strict'; | ||
@@ -10,3 +34,7 @@ | ||
var defaults = { | ||
fadeSpeed: 250 | ||
fadeSpeed: 250, | ||
// the last 2 checkboxes titles | ||
forceFitTitle: "Force fit columns", | ||
syncResizeTitle: "Synchronous resize" | ||
}; | ||
@@ -23,4 +51,5 @@ | ||
// user could pass a title on top of the columns list | ||
if(options.columnPickerTitle) { | ||
var $title = $("<div class='title'/>").append(options.columnPickerTitle); | ||
if(options.columnPickerTitle || (options.columnPicker && options.columnPicker.columnTitle)) { | ||
var columnTitle = options.columnPickerTitle || options.columnPicker.columnTitle; | ||
var $title = $("<div class='title'/>").append(columnTitle); | ||
$title.appendTo($menu); | ||
@@ -75,2 +104,3 @@ } | ||
var forceFitTitle = (options.columnPicker && options.columnPicker.forceFitTitle) || defaults.forceFitTitle; | ||
$("<hr/>").appendTo($list); | ||
@@ -80,3 +110,3 @@ $li = $("<li />").appendTo($list); | ||
$("<label />") | ||
.text("Force fit columns") | ||
.text(forceFitTitle) | ||
.prepend($input) | ||
@@ -88,6 +118,7 @@ .appendTo($li); | ||
var syncResizeTitle = (options.columnPicker && options.columnPicker.syncResizeTitle) || defaults.syncResizeTitle; | ||
$li = $("<li />").appendTo($list); | ||
$input = $("<input type='checkbox' />").data("option", "syncresize"); | ||
$("<label />") | ||
.text("Synchronous resize") | ||
.text(syncResizeTitle) | ||
.prepend($input) | ||
@@ -94,0 +125,0 @@ .appendTo($li); |
@@ -16,9 +16,14 @@ /*** | ||
* gridMenu: { | ||
* customTitle: "Custom Menus", | ||
* columnTitle: "Columns", | ||
* iconImage: "../images/drag-handle.png", // this is the Grid Menu icon (hamburger icon) | ||
* iconCssClass: "fa fa-bars", // you can provide iconImage OR iconCssClass | ||
* leaveOpen: false, // do we want to leave the Grid Menu open after a command execution? (false by default) | ||
* menuWidth: 18, // width that will be use to resize the column header container (18 by default) | ||
* resizeOnShowHeaderRow: true, // true by default | ||
* customTitle: "Custom Menus", // default to empty string | ||
* columnTitle: "Columns", // default to empty string | ||
* iconImage: "../images/drag-handle.png", // this is the Grid Menu icon (hamburger icon) | ||
* iconCssClass: "fa fa-bars", // you can provide iconImage OR iconCssClass | ||
* leaveOpen: false, // do we want to leave the Grid Menu open after a command execution? (false by default) | ||
* menuWidth: 18, // width that will be use to resize the column header container (18 by default) | ||
* resizeOnShowHeaderRow: true, // true by default | ||
* | ||
* // the last 2 checkboxes titles | ||
* forceFitTitle: "Force fit columns", // default to "Force fit columns" | ||
* syncResizeTitle: "Synchronous resize", // default to "Synchronous resize" | ||
* | ||
* customItems: [ | ||
@@ -99,4 +104,6 @@ * { | ||
fadeSpeed: 250, | ||
forceFitTitle: "Force fit columns", | ||
menuWidth: 18, | ||
resizeOnShowHeaderRow: false | ||
resizeOnShowHeaderRow: false, | ||
syncResizeTitle: "Synchronous resize" | ||
}; | ||
@@ -246,2 +253,3 @@ | ||
var forceFitTitle = (_options.gridMenu && _options.gridMenu.forceFitTitle) || _defaults.forceFitTitle; | ||
$("<hr/>").appendTo($list); | ||
@@ -251,3 +259,3 @@ $li = $("<li />").appendTo($list); | ||
$("<label />") | ||
.text("Force fit columns") | ||
.text(forceFitTitle) | ||
.prepend($input) | ||
@@ -259,6 +267,7 @@ .appendTo($li); | ||
var syncResizeTitle = (_options.gridMenu && _options.gridMenu.syncResizeTitle) || _defaults.syncResizeTitle; | ||
$li = $("<li />").appendTo($list); | ||
$input = $("<input type='checkbox' />").data("option", "syncresize"); | ||
$("<label />") | ||
.text("Synchronous resize") | ||
.text(syncResizeTitle) | ||
.prepend($input) | ||
@@ -265,0 +274,0 @@ .appendTo($li); |
(function ($) { | ||
function SlickGridPager(dataView, grid, $container) { | ||
function SlickGridPager(dataView, grid, $container, options) { | ||
var $status; | ||
var _options; | ||
var _defaults = { | ||
showAllText: "Showing all {rowCount} rows", | ||
showPageText: "Showing page {pageNum} of {pageCount}" | ||
}; | ||
function init() { | ||
_options = $.extend(true, {}, _defaults, options); | ||
dataView.onPagingInfoChanged.subscribe(function (e, pagingInfo) { | ||
@@ -136,5 +143,5 @@ updatePager(pagingInfo); | ||
if (pagingInfo.pageSize == 0) { | ||
$status.text("Showing all " + pagingInfo.totalRows + " rows"); | ||
$status.text(_options.showAllText.replace('{rowCount}', pagingInfo.totalRows + "").replace('{pageCount}', pagingInfo.totalPages + "")); | ||
} else { | ||
$status.text("Showing page " + (pagingInfo.pageNum + 1) + " of " + pagingInfo.totalPages); | ||
$status.text(_options.showPageText.replace('{pageNum}', pagingInfo.pageNum + "").replace('{pageCount}', pagingInfo.totalPages + "")); | ||
} | ||
@@ -141,0 +148,0 @@ } |
{ | ||
"name": "slickgrid", | ||
"version": "2.3.10", | ||
"version": "2.3.12", | ||
"description": "A lightning fast JavaScript grid/spreadsheet", | ||
@@ -19,3 +19,5 @@ "main": "slick.core.js", | ||
"author": "Michael Leibman <michael.leibman@gmail.com>", | ||
"contributors": [ "Ben McIntyre <email.ben.mcintyre@gmail.com>" ], | ||
"contributors": [ | ||
"Ben McIntyre <email.ben.mcintyre@gmail.com>" | ||
], | ||
"license": "MIT", | ||
@@ -22,0 +24,0 @@ "bugs": { |
@@ -38,2 +38,3 @@ (function ($) { | ||
function handleSelectedRowsChanged(e, args) { | ||
var UID = createUID(); | ||
var selectedRows = _grid.getSelectedRows(); | ||
@@ -56,5 +57,5 @@ var lookup = {}, row, i; | ||
if (selectedRows.length && selectedRows.length == _grid.getDataLength()) { | ||
_grid.updateColumnHeader(_options.columnId, "<input type='checkbox' checked='checked'>", _options.toolTip); | ||
_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 type='checkbox'>", _options.toolTip); | ||
_grid.updateColumnHeader(_options.columnId, "<input id='header-selector" + UID + "' type='checkbox'><label for='header-selector" + UID + "'></label>", _options.toolTip); | ||
} | ||
@@ -106,3 +107,3 @@ } | ||
var i, l=rowArray.length, addRows = []; | ||
for(i=0; i<l; i++) { | ||
for(i=0; i<l; i++) { | ||
if (!_selectedRowsLookup[rowArray[i]]) { | ||
@@ -117,3 +118,3 @@ addRows[addRows.length] = rowArray[i]; | ||
var i, l=rowArray.length, removeRows = []; | ||
for(i=0; i<l; i++) { | ||
for(i=0; i<l; i++) { | ||
if (_selectedRowsLookup[rowArray[i]]) { | ||
@@ -152,3 +153,3 @@ removeRows[removeRows.length] = rowArray[i]; | ||
var _checkboxColumnCellIndex = null; | ||
function getCheckboxColumnCellIndex() { | ||
@@ -159,3 +160,3 @@ if (_checkboxColumnCellIndex === null) { | ||
for (var i=0; i < colArr.length; i++) { | ||
if (colArr[i].id == _options.columnId) { | ||
if (colArr[i].id == _options.columnId) { | ||
_checkboxColumnCellIndex = i; | ||
@@ -169,5 +170,7 @@ } | ||
function getColumnDefinition() { | ||
var UID = createUID(); | ||
return { | ||
id: _options.columnId, | ||
name: "<input type='checkbox'>", | ||
name: "<input id='header-selector" + UID + "' type='checkbox'><label for='header-selector" + UID + "'></label>", | ||
toolTip: _options.toolTip, | ||
@@ -183,7 +186,13 @@ field: "sel", | ||
function createUID() { | ||
return Math.round(10000000 * Math.random()); | ||
} | ||
function checkboxSelectionFormatter(row, cell, value, columnDef, dataContext) { | ||
var UID = createUID() + row; | ||
if (dataContext) { | ||
return _selectedRowsLookup[row] | ||
? "<input type='checkbox' checked='checked'>" | ||
: "<input type='checkbox'>"; | ||
? "<input id='selector" + UID + "' type='checkbox' checked='checked'><label for='selector" + UID + "'></label>" | ||
: "<input id='selector" + UID + "' type='checkbox'><label for='selector" + UID + "'></label>"; | ||
} | ||
@@ -190,0 +199,0 @@ return null; |
@@ -473,2 +473,6 @@ (function ($) { | ||
function expandCollapseAllGroups(level, collapse) { | ||
@@ -585,3 +589,3 @@ if (level == null) { | ||
} | ||
} | ||
} | ||
@@ -588,0 +592,0 @@ groups.sort(groupingInfos[level].comparer); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
3720455
87221