Skip to content

Commit 8bff501

Browse files
committed
release v2.4.7 - update github.io
1 parent 361219c commit 8bff501

4 files changed

Lines changed: 154 additions & 11 deletions

File tree

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5+
<link rel="shortcut icon" type="image/ico" href="favicon.ico" />
6+
<title>SlickGrid example 3: Editing</title>
7+
<link rel="stylesheet" href="../slick.grid.css" type="text/css"/>
8+
<link rel="stylesheet" href="../css/smoothness/jquery-ui-1.11.3.custom.css" type="text/css"/>
9+
<link rel="stylesheet" href="examples.css" type="text/css"/>
10+
<style>
11+
.cell-title {
12+
font-weight: bold;
13+
}
14+
15+
.cell-effort-driven {
16+
text-align: center;
17+
}
18+
</style>
19+
</head>
20+
<body>
21+
<div style="position:relative">
22+
<div style="width:600px;">
23+
<div id="myGrid" style="width:100%;height:500px;"></div>
24+
</div>
25+
26+
<div class="options-panel">
27+
<h2>Demonstrates:</h2>
28+
<ul>
29+
<li>adding basic keyboard navigation and editing</li>
30+
<li>custom editors and validators</li>
31+
<li>auto-edit settings</li>
32+
</ul>
33+
34+
<h2>Options:</h2>
35+
<button onclick="grid.setOptions({autoEdit:true})">Auto-edit ON</button>
36+
&nbsp;
37+
<button onclick="grid.setOptions({autoEdit:false})">Auto-edit OFF</button>
38+
<h2>View Source:</h2>
39+
<ul>
40+
<li><A href="https://github.com/6pac/SlickGrid/blob/master/examples/example3-editing.html" target="_sourcewindow"> View the source for this example on Github</a></li>
41+
</ul>
42+
43+
<button onclick="grid.gotoCell( 0,0,true )">Goto 0</button>
44+
&nbsp;
45+
<button onclick="grid.gotoCell( 5,0,true )">Goto 5</button>
46+
<div id="eventDiv"></div>
47+
</div>
48+
</div>
49+
50+
<script src="../lib/firebugx.js"></script>
51+
52+
<script src="../lib/jquery-1.11.2.min.js"></script>
53+
<script src="../lib/jquery-ui-1.11.3.min.js"></script>
54+
<script src="../lib/jquery.event.drag-2.3.0.js"></script>
55+
56+
<script src="../slick.core.js"></script>
57+
<script src="../plugins/slick.cellrangedecorator.js"></script>
58+
<script src="../plugins/slick.cellrangeselector.js"></script>
59+
<script src="../plugins/slick.cellselectionmodel.js"></script>
60+
<script src="../plugins/slick.rowselectionmodel.js"></script>
61+
<script src="../slick.formatters.js"></script>
62+
<script src="../slick.editors.js"></script>
63+
<script src="../slick.grid.js"></script>
64+
65+
<script>
66+
function requiredFieldValidator(value) {
67+
if (value == null || value == undefined || !value.length) {
68+
return {valid: false, msg: "This is a required field"};
69+
} else {
70+
return {valid: true, msg: null};
71+
}
72+
}
73+
74+
var grid;
75+
var data = [];
76+
var columns = [
77+
{id: "title", name: "Title", field: "title", width: 120, cssClass: "cell-title", editor: Slick.Editors.Text, validator: requiredFieldValidator},
78+
{id: "desc", name: "Description", field: "description", width: 100, editor: Slick.Editors.LongText},
79+
{id: "duration", name: "Duration", field: "duration", editor: Slick.Editors.Text},
80+
{id: "%", name: "% Complete", field: "percentComplete", width: 80, resizable: false, formatter: Slick.Formatters.PercentCompleteBar, editor: Slick.Editors.PercentComplete},
81+
{id: "start", name: "Start", field: "start", minWidth: 60, editor: Slick.Editors.Date},
82+
{id: "finish", name: "Finish", field: "finish", minWidth: 60, editor: Slick.Editors.Date},
83+
{id: "effort-driven", name: "Effort Driven", width: 80, minWidth: 20, maxWidth: 80, cssClass: "cell-effort-driven", field: "effortDriven", formatter: Slick.Formatters.Checkmark, editor: Slick.Editors.Checkbox}
84+
];
85+
var options = {
86+
editable: true,
87+
enableAddRow: true,
88+
enableCellNavigation: true,
89+
asyncEditorLoading: false,
90+
autoEdit: true
91+
};
92+
93+
$(function () {
94+
for (var i = 0; i < 500; i++) {
95+
var d = (data[i] = {});
96+
97+
d["title"] = "Task " + i;
98+
d["description"] = "This is a sample task description.\n It can be multiline";
99+
d["duration"] = "5 days";
100+
d["percentComplete"] = Math.round(Math.random() * 100);
101+
d["start"] = "01/01/2009";
102+
d["finish"] = "01/05/2009";
103+
d["effortDriven"] = (i % 5 == 0);
104+
}
105+
106+
grid = new Slick.Grid("#myGrid", data, columns, options);
107+
108+
/* I change the selection model to RowSelectionModel from CellSelectionModel */
109+
grid.setSelectionModel(new Slick.RowSelectionModel());
110+
111+
grid.onAddNewRow.subscribe(function (e, args) {
112+
var item = args.item;
113+
grid.invalidateRow(data.length);
114+
data.push(item);
115+
grid.updateRowCount();
116+
grid.render();
117+
});
118+
119+
var eventNum = 0;
120+
grid.onSelectedRowsChanged.subscribe(function (e, args) {
121+
var eventDiv = $("#eventDiv");
122+
eventDiv.text(eventDiv.text() + "onSelectedRowsChanged-" + eventNum++ + " ");
123+
});
124+
125+
/* i try to reproduce the situation using my class but it's not necessary.*/
126+
// in the version 2.3.2 when i was call the function gotoCell,
127+
// the row went selected and the callback subscribed in onSelectRow event's was triggered.
128+
// But in this new version the only one thing that works is the editor.
129+
130+
})
131+
</script>
132+
</body>
133+
</html>

SlickGrid/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "slickgrid",
3-
"version": "2.4.6",
3+
"version": "2.4.7",
44
"description": "A lightning fast JavaScript grid/spreadsheet",
55
"main": "slick.core.js",
66
"directories": {

SlickGrid/plugins/slick.sizetocontent.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@
1313
// AutoColumnSize plugin options
1414
// -----------------------------
1515
// option
16-
// .viewportMode: FitColsToViewport (Scroll, FitColsToViewport, FitViewportToCols)
16+
// .viewportMode: Legacy (Legacy, IgnoreViewport, FitColsToViewport, FitViewportToCols)
1717
// .switchToScrollModeWidthPercent: undefined
1818
// .minViewportWidthPx: undefined
1919
// .maxViewportWidthPx: undefined
2020
//
21+
// forceFitColumns
22+
// absoluteColumnMinWidth - internal setting calulated from cell border and padding
23+
//
2124
// DETAILS
2225
//
2326
// viewportMode
@@ -31,7 +34,7 @@
3134
// ViewportModes
3235
// -------------
3336
//
34-
// Scroll:
37+
// IgnoreViewport:
3538
// - columns are sized independently of the viewport width. There will be empty space at the
3639
// right of the viewport if the columns are smaller, and a horizontal scroll bar if they are larger.
3740
// - SizeToRemaining is ignored, its presence will trigger a console message
@@ -40,7 +43,7 @@
4043
// - columns sized are calculated using the column strategies
4144
// - if addl space remains in the viewport and there are SizeToRemaining cols, just the
4245
// SizeToRemaining cols expand proportionally to fill viewport
43-
// - if the total columns width is wider than the viewport by switchToScrollModeWidthPercent, switch to Scroll mode
46+
// - if the total columns width is wider than the viewport by switchToScrollModeWidthPercent, switch to IgnoreViewport mode
4447
// - otherwise (ie. no SizeToRemaining cols or viewport smaller than columns) all cols other
4548
// than 'Locked' scale in proportion to fill viewport
4649
//
@@ -60,10 +63,15 @@
6063
// .autosizeMode: ContentIntelligent (Lock, Guide, Content, ContentIntelligent)
6164
// .rowSelectionModeOnInit: undefined (FirstRow, LastRow)
6265
// .rowSelectionMode: FirstNRows (FirstRow, FirstNRows, AllRows)
63-
// .valueFilterMode: none (None, DeDuplicate, GetGreatest, GetLongestText, CanvasTextSize, CompareFunction())
64-
// .sizeToRemaining: undefined
6566
// .rowSelectionCount: 100
67+
// .valueFilterMode: None (None, DeDuplicate, GetGreatest, GetLongestText, CompareFunction())
68+
// .widthEvalMode: HTML (CanvasTextSize, HTML)
69+
// .sizeToRemaining: undefined
6670
//
71+
// columnDefaults.resizable
72+
// columnDefaults.minWidth
73+
// columnDefaults.maxWidth
74+
//
6775
// DETAILS
6876
//
6977
// ignoreHeaderText
@@ -125,9 +133,9 @@
125133
//
126134

127135
var ViewportMode = {
128-
Scroll: 'SC',
129-
FitColsToViewport: 'FV',
130-
FitViewportToCols: 'FC'
136+
IgnoreViewport: 'IGV',
137+
FitColsToViewport: 'FCV',
138+
FitViewportToCols: 'FVC'
131139
};
132140
if (Object.freeze) { Object.freeze(ViewportMode); }
133141

SlickGrid/slick.grid.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5059,7 +5059,9 @@ if (typeof Slick === "undefined") {
50595059
var newCell = getCellNode(row, cell);
50605060

50615061
// if selecting the 'add new' row, start editing right away
5062-
setActiveCellInternal(newCell, (forceEdit || (row === getDataLength()) || options.autoEdit), null, options.editable, e);
5062+
var column = columns[cell];
5063+
var suppressActiveCellChangedEvent = !!(options.editable && column && column.editor && options.suppressActiveCellChangeOnEdit);
5064+
setActiveCellInternal(newCell, (forceEdit || (row === getDataLength()) || options.autoEdit), null, suppressActiveCellChangedEvent, e);
50635065

50645066
// if no editor was created, set the focus back on the grid
50655067
if (!currentEditor) {
@@ -5208,7 +5210,7 @@ if (typeof Slick === "undefined") {
52085210
// Public API
52095211

52105212
$.extend(this, {
5211-
"slickGridVersion": "2.4.6",
5213+
"slickGridVersion": "2.4.7",
52125214

52135215
// Events
52145216
"onScroll": new Slick.Event(),

0 commit comments

Comments
 (0)