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

Add on render callback #1050

Open
wants to merge 134 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
134 commits
Select commit Hold shift + click to select a range
1ab2490
Merge branch 'master' into gh-pages
mleibman Nov 20, 2013
a5ffbc2
Merge branch 'master' into gh-pages
mleibman Dec 4, 2013
ce6fb91
Setting up the grid for every test makes them idempotent, which is de…
Mar 6, 2014
0387257
Add a test to validate current method of updating column widths: `set…
Mar 6, 2014
f80f34b
Made the grid a little larger to create a more realistic performance …
Mar 6, 2014
a9099b9
new grid method `updateColumnWidths` provides a fast, surgical way to…
Mar 6, 2014
3388762
Removed some unneeded comments
Mar 6, 2014
3be7645
Update README.md
Mar 31, 2014
a4670a1
Update README.md
Mar 31, 2014
6409a08
Added a bower file for submittal to the bower repo
Mar 31, 2014
dc7a325
why the tag is changed
Mar 31, 2014
72cd762
versioning
Mar 31, 2014
a415788
still learning versioning
Mar 31, 2014
2700508
expose 'setupColumnResize' method
Apr 1, 2014
f1e529a
Merge pull request #1 from albertywu/master
Apr 1, 2014
cf2cc9e
bump version, update readme
Apr 1, 2014
cbf3fd5
Add support for Slick Ranges toCell, toRow equal to Infinity.
May 20, 2014
57bc446
bump up release
May 20, 2014
204cadc
Merge pull request #2 from albertywu/master
May 21, 2014
2daaf0b
New option `columnHeaderRenderer` lets you specify the markup to be u…
Jul 28, 2014
dfb9476
updating the grid canvas width AND cell width. previous behavior was …
Jul 29, 2014
5476b0c
updateColumnWidths should resize grid cells even if they canvas hasn'…
Jul 29, 2014
3430126
remove test string from the default columnHeaderRenderer callback
Jul 29, 2014
2a83e8b
DRY up the calculation of viewportW, and allow a manual setting of it…
Aug 7, 2014
bc1342c
Expose a .getId() method, which allows a consumer to get the uid of t…
Aug 7, 2014
3c4bc64
Added features to `setColumns`. It triggers a new event called `onCol…
Aug 7, 2014
c79b871
.resizeCanvas supports an option to specify a width and skip height c…
Aug 7, 2014
40b0bb6
trigger `onColumnsResized` whenever the width of them changes (e.g.: …
Aug 7, 2014
6c1da17
Version Release
Aug 7, 2014
15363a4
Keep col instance unmolested during a setColumns. Also add an onInval…
Aug 11, 2014
49609d9
Merge in read me changes from upstream
Aug 12, 2014
e61b5a7
When a column is drag-to-resized, mark col.manuallySized = true. This…
Sep 16, 2014
49dac37
add option to resize only the dragged column
Oct 29, 2014
054f9a9
fixed an issue where the dataView variable was being accessed but did…
Dec 19, 2013
0df0ec8
Fix #864 - Implement a 'destroy' method on Slick.ColumnPicker.
mleibman Jan 20, 2014
8e6c9e7
Setting up the grid for every test makes them idempotent, which is de…
Mar 6, 2014
ec6b328
Add a test to validate current method of updating column widths: `set…
Mar 6, 2014
bc2b28d
Made the grid a little larger to create a more realistic performance …
Mar 6, 2014
c3feedf
new grid method `updateColumnWidths` provides a fast, surgical way to…
Mar 6, 2014
6486c2c
Removed some unneeded comments
Mar 6, 2014
336a409
Update README.md
Mar 31, 2014
1a299ec
Update README.md
Mar 31, 2014
76f9d79
Added a bower file for submittal to the bower repo
Mar 31, 2014
a8ca1dc
why the tag is changed
Mar 31, 2014
1b115fd
versioning
Mar 31, 2014
b6664c0
still learning versioning
Mar 31, 2014
a262739
expose 'setupColumnResize' method
Apr 1, 2014
5d4db42
bump version, update readme
Apr 1, 2014
33c514d
Update README.md
mleibman May 5, 2014
a305c2b
Add support for Slick Ranges toCell, toRow equal to Infinity.
May 20, 2014
bac3587
bump up release
May 20, 2014
7219c43
New option `columnHeaderRenderer` lets you specify the markup to be u…
Jul 28, 2014
8f69e1d
updating the grid canvas width AND cell width. previous behavior was …
Jul 29, 2014
f0a8b52
updateColumnWidths should resize grid cells even if they canvas hasn'…
Jul 29, 2014
478388a
remove test string from the default columnHeaderRenderer callback
Jul 29, 2014
a0c0e74
DRY up the calculation of viewportW, and allow a manual setting of it…
Aug 7, 2014
be46e59
Expose a .getId() method, which allows a consumer to get the uid of t…
Aug 7, 2014
b6e3c99
Added features to `setColumns`. It triggers a new event called `onCol…
Aug 7, 2014
8fd9f54
.resizeCanvas supports an option to specify a width and skip height c…
Aug 7, 2014
f9df163
trigger `onColumnsResized` whenever the width of them changes (e.g.: …
Aug 7, 2014
1664319
Version Release
Aug 7, 2014
eac9d6f
Keep col instance unmolested during a setColumns. Also add an onInval…
Aug 11, 2014
0aed298
When a column is drag-to-resized, mark col.manuallySized = true. This…
Sep 16, 2014
6676b52
add option to resize only the dragged column
Oct 29, 2014
71a96ab
Merge branch 'gh-pages' of github.com:SimpleAsCouldBe/SlickGrid into …
Nov 18, 2014
088f0a7
top-level index.html
Nov 18, 2014
2b905a3
run `npm install`, then `gulp` for a live reloading dev environment
Nov 18, 2014
c0e4e85
adding enough columns to be sure when it virtualizes them
Nov 18, 2014
9343048
...I'm in it now.
Nov 18, 2014
7d9a877
Progress. cells and headers on screen for the first time.
Nov 19, 2014
b4ed752
test commit
Nov 19, 2014
121e28b
All thrown errors seen during scrolling have been squashed
Nov 20, 2014
a2cca90
fix: If you're scrolled all the way right and then scroll down, it do…
Nov 20, 2014
9a87a04
Storing sizing calculations in a data structure that represents the u…
Nov 20, 2014
93b4c27
Took everything apart, renamed it, put it back together again.
Nov 21, 2014
cf617c2
documentation update
Nov 21, 2014
418d8e3
Rename `headerRow` to `subHeader` (including options `showSubHeader` …
Nov 21, 2014
80ca124
Remove `calculateHeadersWidth()` and `setHeadersWidth()`. No reason f…
Nov 21, 2014
86815de
rowHeight and subHeaderHeight are now determined by your CSS, measure…
Nov 22, 2014
bd894f4
minimal augment of `handleSelectedRangesChanged()`: clip userland spe…
GerHobbelt Nov 23, 2014
ad815d6
A more elegant fix for webkit inertial scrolling bug http://crbug.com…
Nov 25, 2014
0004c22
Supports creating the grid with `[]` columns, then using `setColumns(…
Nov 26, 2014
719632c
alias `headerRow` for backwards compatibility
Nov 26, 2014
ae918ea
cellNodesByColumnIdx should always store a raw dom element, not a jqu…
Nov 26, 2014
2aaa440
Fix updateColumnWidths() so it works with the new method of specifyin…
Nov 26, 2014
88f97db
You can change the pinned column at any time using `setOptions`, and …
Nov 29, 2014
93a8633
Merge pull request #3 from GerHobbelt/SACB-pincushion
Dec 1, 2014
dc37764
new public method `getHeaderEls([idx])` gives you the column header e…
Dec 3, 2014
913afb0
New methods: getColumnIndexFromEvent and getColumnFromEvent let consu…
Dec 3, 2014
0538680
handleHeaderClick, onHeaderContextMenu fixed.
Dec 3, 2014
1f092e9
example 4 logs slick grid events as they happen for education and tes…
Dec 3, 2014
f905bfe
Make absoluteColumnMinWidth a configurable option (that most folks wo…
Dec 3, 2014
584d891
Update the pinned canvas size while resizing columns
Dec 3, 2014
910969c
more specific error messaging for incorrect data view ids
Dec 4, 2014
127c40e
preparing to test and develop grouping in a pinned context
Dec 4, 2014
c509a33
Basic grouping works with and without pinned columns
Dec 4, 2014
076f5a4
slick grid example with a working, pinned totals row
Dec 4, 2014
0ed2a18
simplify grouping example
Dec 4, 2014
a996fbc
links to examples
Dec 4, 2014
de0d505
in `handleSelectedRangesChanged`: Using getDataLength() instead, so w…
Dec 4, 2014
a574b71
Hiding focus state for grid regions correctly and reenabling some tes…
Dec 4, 2014
4c307b5
`grid.getHeaderEl()` Return the header element(s) that wrap all colum…
Dec 4, 2014
29962e9
whitespace
Dec 5, 2014
911af13
Support using setOptions to pin and unpin columns whenever you want. …
Dec 5, 2014
03b33d3
Supporting configurable height rows, as well as auto calculated ones.
Dec 6, 2014
257069a
Removing working notes. simpler debug logs.
Dec 8, 2014
4ed9f62
Merge pull request #4 from SimpleAsCouldBe/pincushion
Dec 8, 2014
d640936
Not all subheaders need to render. gracefully handle undefined subHea…
albertywu Dec 8, 2014
bf38682
adding onSubHeaderContextMenu event channel / trigger
albertywu Dec 8, 2014
9781783
call resizeCanvas whenever setSubHeaderVisibility is called
albertywu Dec 9, 2014
6e4f4db
call subHeader renderer regardless of whether subHeader is visible or…
albertywu Dec 9, 2014
91e3eaf
added methods to get top canvas element
albertywu Dec 9, 2014
6a05616
add getColumnNodeById(id)
albertywu Dec 9, 2014
d14d713
add grid.crossesPinnedArea(indices) method.
albertywu Dec 10, 2014
3030f76
crossesPinnedArea: can't cross a boundary if there are 0 or 1 indices…
albertywu Dec 10, 2014
c580182
fix logic bug
albertywu Dec 10, 2014
da1d9e8
Fix .selected style and rename .copied style so spreadsheet example w…
Dec 10, 2014
476fec7
All slick grid classic examples either enabled or commented out with …
Dec 10, 2014
caf4477
new event 'onHeadersCreated' triggered whenever column headers and su…
Dec 11, 2014
1e62542
project info update
Dec 11, 2014
244053a
scrollRowIntoView now correctly functions on both content viewports
Dec 11, 2014
707d3dd
when calling scrollCellIntoView, don't do any X scrolling if the cell…
Dec 11, 2014
844b8fe
silence console
Dec 11, 2014
8e5ad05
active header cells shouldn't get colored
Dec 11, 2014
ba35622
Support fullWidthRows with and without pinned columns
Dec 11, 2014
8d40bf2
add column header dragstart, drag, dragend event triggers
albertywu Dec 12, 2014
dbc83f0
new public method updateSubHeader(columnId) redraws a single subHeade…
Dec 12, 2014
67db019
Support scrolling while the cursor is over either the left or right v…
Dec 31, 2014
9ea7225
Translate mouse wheel events from the header onto the grid so you can…
Dec 31, 2014
bea5e37
hide scrollbars on pinned columns
bcherny Jan 26, 2015
957941f
Merge pull request #5 from bcherny/master
Jan 27, 2015
b24ef3b
add antiscroll
bcherny Jan 30, 2015
fe28e2b
Merge pull request #7 from SimpleAsCouldBe/personal/bcherny/add-antis…
bcherny Jan 30, 2015
cad7d59
add an onRender callback hook
albertywu Feb 2, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
.gitk*
.idea/*
.DS_Store

# node stuff
node_modules/
npm-debug.log

# sass stuff
.sass-cache/
62 changes: 58 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,65 @@
# Welcome to SlickGrid
# About the column pinning effort

Find documentation and examples in [the wiki](https://github.com/mleibman/SlickGrid/wiki).
This fork adds pinned columns to slickgrid. There was a fair amount of code rewrite involved. Work in progress.

## [Pinned Column Examples](http://git.simple.gy/SlickGrid/)

## Renaming

To support pinned columns, we slice up the grid regions, and try to be very clear and consistent about the naming.
This is because having a left and right region for every content area makes a flat list of naming conventions multiply quickly.
I also was uncomfortable with the proliferation of names like `header`, `headerScroller`, and `headerRow`.

Two big changes:
1. UI components are labeled top to bottom by what control they are.
2. `headerRow` renamed to `subHeader`. The old name was confusing. TODO: This means the name of related options has changed, too.

Canvases always represent content size, viewports always represent scrollable regions.

Every element has side `[0]` and side `[1]`, for left and right.

```
Visual Grid Components
[0] [1]
....................
topViewport . . . // The scrolling region
topCanvas . . . // The full size of content (both off and on screen)
header . . . // The column headers
subHeader . . . // Optional row of cells below the column headers
....................
contentViewportWrap . . .
contentViewport . . . // The scrolling region for the grid rows
contentCanvas . . . // Full size of row content, both width and height
. . .
. . .
. . .
. . .
. . .
....................
```

## Other Changes:

**UPDATE: March 5th, 2014 - I have too many things going on in my life right now to really give SlickGrid support and development the time and attention it deserves. I am not stopping it, but I will most likely be unresponsive for some time. Sorry.**
**Adds some methods** that make it more performant to do auto column resizing and exposes some methods that make it easier to work with multiple grid instances and pinned columns.

* `grid.updateColumnWidths(columnDefinitions)`
* Using this method improves the performance of changing the width of one or more grid columns by a lot. The existing API only allows for a whole grid redraw, which can be very slow. Pull request with notes [here](https://github.com/mleibman/SlickGrid/pull/897). Use cases for fast column size adjustment may be: auto-sizing columns to fit content, responsive sizing cells to fill the screen, and similar.
* `grid.getId()` lets you get the uid of the grid instance
* Triggers existing event `onColumnsResized` when you change the column widths
* Triggers a new event `onColumnsChanged` when you set the columns
* Exposes the existing method `grid.setupColumnResize`, which allows you to re-enable column resizing if you're manually screwing around with the headers.
* Some new options on `setColumns` and `resizeCanvas` let you prevent some of the expensive calculations, useful if you're doing them yourself externally.

**Adds [antiscroll](https://github.com/learnboost/antiscroll) compatability** to enable a uniform, OSX-style scrolling experience across browsers. Enable antiscroll by including the antiscroll library on your page, and passing the `useAntiscroll: true` option to your SlickGrid instance. By default we don't show scrollbars until the user begins scrolling (to mimic the way OSX does it); to change that behavior, you can set the `showScrollbarsOnHover` option.


## (Original Documentation) Welcome to SlickGrid

**UPDATE From Mr. Leibman: March 5th, 2014 - I have too many things going on in my life right now to really give SlickGrid support and development the time and attention it deserves. I am not stopping it, but I will most likely be unresponsive for some time. Sorry.**

Find documentation and examples in [the wiki](https://github.com/mleibman/SlickGrid/wiki).

## SlickGrid is an advanced JavaScript grid/spreadsheet component
### SlickGrid is an advanced JavaScript grid/spreadsheet component

Some highlights:

Expand Down
25 changes: 25 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "slickgrid",
"version": "2.3.4",
"homepage": "https://github.com/SimpleAsCouldBe/SlickGrid",
"authors": [
"Michael Leibman",
"Eric Miller"
],
"description": "Slickgrid with pinning, more customizability, and faster column sizing.",
"moduleType": [
"globals"
],
"keywords": [
"slickgrid",
"pinned",
"performance",
"autosize",
"column",
"size"
],
"license": "MIT",
"dependencies": {
"antiscroll": "bcherny/antiscroll"
}
}
10 changes: 6 additions & 4 deletions examples/example-header-row.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ <h2>View Source:</h2>
enableCellNavigation: true,
showHeaderRow: true,
headerRowHeight: 30,
explicitInitialization: true
explicitInitialization: true,
showSubHeader: true,
// subHeaderRenderer: function(col){ return $('<div><input type="text"/></div>') }
};
var columns = [];
var columnFilters = {};

for (var i = 0; i < 10; i++) {
for (var i = 0; i < 20; i++) {
columns.push({
id: i,
name: String.fromCharCode("A".charCodeAt(0) + i),
Expand Down Expand Up @@ -111,15 +113,15 @@ <h2>View Source:</h2>
});


$(grid.getHeaderRow()).delegate(":input", "change keyup", function (e) {
$(grid.getSubHeader()).delegate(":input", "change keyup", function (e) {
var columnId = $(this).data("columnId");
if (columnId != null) {
columnFilters[columnId] = $.trim($(this).val());
dataView.refresh();
}
});

grid.onHeaderRowCellRendered.subscribe(function(e, args) {
grid.onSubHeaderCellRendered.subscribe(function(e, args) {
$(args.node).empty();
$("<input type='text'>")
.data("columnId", args.column.id)
Expand Down
2 changes: 1 addition & 1 deletion examples/example-spreadsheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" href="../css/smoothness/jquery-ui-1.8.16.custom.css" type="text/css"/>
<link rel="stylesheet" href="examples.css" type="text/css"/>
<style>
.slick-cell.copied {
.slickGrid .cell.copied {
background: blue;
background: rgba(0, 0, 255, 0.2);
-webkit-transition: 0.5s background;
Expand Down
8 changes: 4 additions & 4 deletions examples/example1-simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ <h2>Demonstrates:</h2>
<ul>
<li>basic grid with minimal configuration</li>
</ul>
<h2>View Source:</h2>
<ul>
<li><A href="https://github.com/mleibman/SlickGrid/blob/gh-pages/examples/example1-simple.html" target="_sourcewindow"> View the source for this example on Github</a></li>
</ul>
<h2>View Source:</h2>
<ul>
<li><A href="https://github.com/mleibman/SlickGrid/blob/gh-pages/examples/example1-simple.html" target="_sourcewindow"> View the source for this example on Github</a></li>
</ul>
</td>
</tr>
</table>
Expand Down
6 changes: 3 additions & 3 deletions examples/example8-alternative-display.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" href="../css/smoothness/jquery-ui-1.8.16.custom.css" type="text/css"/>
<link rel="stylesheet" href="examples.css" type="text/css"/>
<style>
.slick-cell {
.cell {
background: white !important;
border-color: transparent !important;
line-height: 19px !important;
Expand All @@ -18,8 +18,8 @@
margin-right: 60px;
}

.slick-row[row$="1"] .cell-inner, .slick-row[row$="3"] .cell-inner, .slick-row[row$="5"] .cell-inner,
.slick-row[row$="7"] .cell-inner, .slick-row[row$="9"] .cell-inner {
.row[row$="1"] .cell-inner, .slick-row[row$="3"] .cell-inner, .slick-row[row$="5"] .cell-inner,
.row[row$="7"] .cell-inner, .slick-row[row$="9"] .cell-inner {
margin-left: 60px;
margin-right: 0;
}
Expand Down
61 changes: 0 additions & 61 deletions examples/index.html

This file was deleted.

97 changes: 97 additions & 0 deletions examples/pincushion1-simple.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Pinned Columns - Pincushion Example 1</title>
<link rel="stylesheet" href="../slick.grid.css" type="text/css"/>
<link rel="stylesheet" href="examples.css" type="text/css"/>
</head>
<body>
<table width="100%">
<tr>
<td valign="top" width="50%">
<div id="myGrid" style="width:500px;height:500px;"></div>
</td>
<td valign="top">
<h2>Demonstrates:</h2>
<ul>
<li>Simplest case of pinned columns</li>
</ul>
<button onclick="unpin()">Clear Pin</button><br/><br/>
<input id="PinnedColumn" type="number" max="5" min="0" value="0" style="width:25px;"/> <button onclick="pin()">Pin</button><br/>
</td>
</tr>
</table>

<script src="../lib/jquery-1.7.min.js"></script>
<script src="../lib/jquery.event.drag-2.2.js"></script>

<script src="../slick.core.js"></script>
<script src="../slick.grid.js"></script>

<script>

function unpin () {
grid.setOptions({ pinnedColumn: null }); // `undefined` also works
}

function pin () {
var val = document.getElementById('PinnedColumn').value;
val = parseInt(val);
if (isNaN( val )){ return; }
grid.setOptions({ pinnedColumn: val });
}

var grid;
var columns = [
{ id: "title", name: "Title", field: "title"},
{ id: "%", name: "% Complete", field: "percentComplete"},
{ id: "duration", name: "Duration", field: "duration"},
{ id: "start", name: "Start", field: "start"},
{ id: "finish", name: "Finish", field: "finish"},
{ id: "effort-driven", name: "Effort Driven", field: "effortDriven"},
{ id: "duration", name: "Duration", field: "duration"},
{ id: "%", name: "% Complete", field: "percentComplete"},
{ id: "start", name: "Start", field: "start"},
{ id: "finish", name: "Finish", field: "finish"},
{ id: "effort-driven", name: "Effort Driven", field: "effortDriven"},
{ id: "duration", name: "Duration", field: "duration"},
{ id: "%", name: "% Complete", field: "percentComplete"},
{ id: "start", name: "Start", field: "start"},
{ id: "finish", name: "Finish", field: "finish"},
{ id: "effort-driven", name: "Effort Driven", field: "effortDriven"},
{ id: "duration", name: "Duration", field: "duration"},
{ id: "%", name: "% Complete", field: "percentComplete"},
{ id: "start", name: "Start", field: "start"},
{ id: "finish", name: "Finish", field: "finish"},
{ id: "effort-driven", name: "Effort Driven", field: "effortDriven"}
];

var options = {
pinnedColumn: 0,
debug: false
};



$(function () {
var data = [];
for (var i = 0; i < 500; i++) {
data[i] = {
title: "Task " + i,
duration: "5 days",
percentComplete: Math.round(Math.random() * 100),
start: "01/01/2009",
finish: "01/05/2009",
effortDriven: (i % 5 == 0)
};
}

window._grid = grid = new Slick.Grid("#myGrid", data, columns, options);



})
</script>
</body>
</html>
Loading