Skip to content
This repository was archived by the owner on Jul 25, 2019. It is now read-only.

Commit e3a4c12

Browse files
committed
Merge branch 'develop' of git://github.com/psmolenski/jquery-handsontable into develop
2 parents 641c166 + 9525bba commit e3a4c12

37 files changed

+2066
-776
lines changed

CHANGELOG.md

+24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
## [0.9.12](https://github.com/warpech/jquery-handsontable/tree/v0.9.11) (Aug 06, 2013)
2+
Features
3+
4+
- closing cell editors when table is being scrolled ([#914](https://github.com/warpech/jquery-handsontable/issues/914))
5+
- added `sort()` method to programically sort table
6+
- plugin `contextMenu` can now be enabled or disabled using `updateSettings()` method
7+
- extension `removeRow` can now be enabled or disabled using `updateSettings()` method
8+
- plugin `observeChanges` can now be enabled or disabled using `updateSettings()` method
9+
- plugin `autoColumnSize` can now be enabled or disabled using `updateSettings()` method
10+
- 2 new events: `beforColumnSort` and `afterColumnSort` fired before and after table sort
11+
12+
Bugfixes
13+
14+
- added more specyfic selectrors in CSS, so that jQuery UI styles and default HandsonTable styles does not interfere ([#498](https://github.com/warpech/jquery-handsontable/issues/498))
15+
- fixed moving table column, when table is scrolled horizotally ([#527](https://github.com/warpech/jquery-handsontable/issues/527))
16+
- `afterRender` event is now fired after every table scroll ([#733](https://github.com/warpech/jquery-handsontable/issues/733))
17+
- fixed inserting and removing rows form sorted table ([#915](https://github.com/warpech/jquery-handsontable/issues/915))
18+
- added proper mapping of cell properties when table is sorted ([#917](https://github.com/warpech/jquery-handsontable/issues/917))
19+
- fixed IE `Array.filter()` shim ([#934](https://github.com/warpech/jquery-handsontable/issues/934))
20+
- fixed tests, so that they all pass on Sauce Labs servers
21+
22+
23+
24+
125
## [0.9.11](https://github.com/warpech/jquery-handsontable/tree/v0.9.11) (Jul 29, 2013)
226

327
This version fixes some severe cell listener issues introduced in the last version.

Gruntfile.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ module.exports = function (grunt) {
8888

8989
'src/3rdparty/jquery.autoresize.js',
9090
'src/3rdparty/sheetclip.js',
91-
'src/3rdparty/copypaste.js'
91+
'src/3rdparty/copypaste.js',
92+
'src/3rdparty/json-patch-duplex.js'
9293
],
9394
walkontable: [
9495
'src/3rdparty/walkontable/src/*.js',
@@ -110,10 +111,10 @@ module.exports = function (grunt) {
110111
dist: {
111112
files: {
112113
'dist/jquery.handsontable.js': [
113-
'<%= meta.shims %>',
114114
'tmp/intro.js',
115115
'<%= meta.src %>',
116116
'<%= meta.walkontable %>',
117+
'<%= meta.shims %>',
117118
'src/outro.js'
118119
]
119120
}

demo/bigCells.html

+21
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ <h1><a href="../index.html">Handsontable</a></h1>
6060
<h2>Big cells</h2>
6161

6262

63+
<div id="example0" style="width: 400px; height: 300px; overflow: scroll"></div>
6364
<div id="example1" style="width: 400px; height: 300px; overflow: scroll"></div>
6465
<div id="example2" style="width: 400px; height: 300px; overflow: scroll"></div>
6566
<div id="example3" style="width: 400px; height: 300px; overflow: scroll"></div>
@@ -79,6 +80,26 @@ <h2>Big cells</h2>
7980
</div>
8081

8182
<script data-jsfiddle="example1">
83+
84+
colHeaders = ["Column1", "Column2", "Column3", "Column4", "Column5", "Column6", "Column7", "Column8", "Column9", "Column10", "Column11", "Column12", "Column13", "Column14", "Column15", "Column16", "Column17", "Column18", "Column19", "Column20"];
85+
rowHeaders = ["Value"];
86+
87+
var exampleData = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]];
88+
89+
var exampleGrid = $("#example0");
90+
exampleGrid.handsontable({
91+
rowHeaders: rowHeaders,
92+
colHeaders: colHeaders,
93+
colWidths: 50,
94+
manualColumnResize: true,
95+
stretchH: 'all',
96+
minSpareCols: 0,
97+
minSpareRows: 0,
98+
contextMenu: false,
99+
});
100+
exampleGrid.handsontable("loadData", exampleData);
101+
102+
82103
var data = [
83104
[1, "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. ", "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a ga" ],
84105
[2, "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like)."],

extensions/jquery.handsontable.removeRow.js

+61-37
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,78 @@
55
* Handsontable RemoveRow extension. See `demo/buttons.html` for example usage
66
* See `.../test/jasmine/spec/extensions/removeRowSpec.js` for tests
77
*/
8-
Handsontable.PluginHooks.add('beforeInitWalkontable', function (walkontableConfig) {
8+
9+
function init() {
910
var instance = this;
1011

11-
if (instance.getSettings().removeRowPlugin) {
12+
var pluginEnabled = !!(instance.getSettings().removeRowPlugin);
1213

13-
var getButton = function (td) {
14-
return $(td).parent('tr').find('th.htRemoveRow').eq(0).find('.btn');
15-
};
14+
if (pluginEnabled) {
15+
bindMouseEvents();
16+
instance.rootElement.addClass('htRemoveRow');
17+
} else {
18+
unbindMouseEvents();
19+
instance.rootElement.removeClass('htRemoveRow');
20+
}
1621

17-
instance.rootElement.on('mouseover', 'tbody th, tbody td', function () {
22+
function bindMouseEvents() {
23+
instance.rootElement.on('mouseover.removeRow', 'tbody th, tbody td', function () {
1824
getButton(this).show();
1925
});
20-
instance.rootElement.on('mouseout', 'tbody th, tbody td', function () {
26+
instance.rootElement.on('mouseout.removeRow', 'tbody th, tbody td', function () {
2127
getButton(this).hide();
2228
});
29+
}
30+
31+
function unbindMouseEvents() {
32+
instance.rootElement.off('mouseover.removeRow');
33+
instance.rootElement.off('mouseout.removeRow');
34+
}
35+
36+
function getButton(td) {
37+
return $(td).parent('tr').find('th.htRemoveRow').eq(0).find('.btn');
38+
}
39+
}
2340

24-
instance.rootElement.addClass('htRemoveRow');
2541

26-
/**
27-
* rowHeaders is a function, so to alter the actual value we need to alter the result returned by this function
28-
*/
29-
var baseRowHeaders = walkontableConfig.rowHeaders;
30-
walkontableConfig.rowHeaders = function(){
31-
32-
var newRowHeader = function (row, elem) {
33-
var child
34-
, div;
35-
while (child = elem.lastChild) {
36-
elem.removeChild(child);
37-
}
38-
elem.className = 'htNoFrame htRemoveRow';
39-
if (row > -1) {
40-
div = document.createElement('div');
41-
div.className = 'btn';
42-
div.appendChild(document.createTextNode('x'));
43-
elem.appendChild(div);
44-
45-
$(div).on('mouseup', function () {
46-
instance.alter("remove_row", row);
47-
});
48-
}
49-
};
50-
51-
52-
53-
return Array.prototype.concat.call([], newRowHeader, baseRowHeaders());
42+
Handsontable.PluginHooks.add('beforeInitWalkontable', function (walkontableConfig) {
43+
var instance = this;
44+
45+
/**
46+
* rowHeaders is a function, so to alter the actual value we need to alter the result returned by this function
47+
*/
48+
var baseRowHeaders = walkontableConfig.rowHeaders;
49+
walkontableConfig.rowHeaders = function () {
50+
var pluginEnabled = Boolean(instance.getSettings().removeRowPlugin);
51+
52+
var newRowHeader = function (row, elem) {
53+
var child
54+
, div;
55+
while (child = elem.lastChild) {
56+
elem.removeChild(child);
57+
}
58+
elem.className = 'htNoFrame htRemoveRow';
59+
if (row > -1) {
60+
div = document.createElement('div');
61+
div.className = 'btn';
62+
div.appendChild(document.createTextNode('x'));
63+
elem.appendChild(div);
64+
65+
$(div).on('mouseup', function () {
66+
instance.alter("remove_row", row);
67+
});
68+
}
5469
};
5570

56-
}
71+
return pluginEnabled ? Array.prototype.concat.call([], newRowHeader, baseRowHeaders()) : baseRowHeaders();
72+
};
73+
});
74+
75+
Handsontable.PluginHooks.add('beforeInit', function () {
76+
init.call(this)
77+
});
78+
79+
Handsontable.PluginHooks.add('afterUpdateSettings', function () {
80+
init.call(this)
5781
});
5882
})(jQuery);

lib/shims/array.filter.js

+22-4
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,38 @@ if (!Array.prototype.filter) {
1515

1616
thisp = thisp || this;
1717

18-
var len = this.length,
18+
if (isNodeList(thisp)) {
19+
thisp = convertNodeListToArray(thisp);
20+
}
21+
22+
var len = thisp.length,
1923
res = [],
2024
i,
2125
val;
2226

2327
for (i = 0; i < len; i += 1) {
24-
if (this.hasOwnProperty(i)) {
25-
val = this[i]; // in case fun mutates this
26-
if (fun.call(thisp, val, i, this)) {
28+
if (thisp.hasOwnProperty(i)) {
29+
val = thisp[i]; // in case fun mutates this
30+
if (fun.call(thisp, val, i, thisp)) {
2731
res.push(val);
2832
}
2933
}
3034
}
3135

3236
return res;
37+
38+
function isNodeList(object) {
39+
return /NodeList/i.test(object.item);
40+
}
41+
42+
function convertNodeListToArray(nodeList) {
43+
var array = [];
44+
45+
for (var i = 0, len = nodeList.length; i < len; i++){
46+
array[i] = nodeList[i]
47+
}
48+
49+
return array;
50+
}
3351
};
3452
}

0 commit comments

Comments
 (0)