rails_handsontable 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
+ # Browser base Excel In rails gem . Excel can show in html
2
+
1
3
  # RailsHandsontable
2
4
 
3
- TODO: Write a gem description
5
+ This gem is created for rails users .
4
6
 
5
7
  ## Installation
6
8
 
@@ -18,7 +20,12 @@ Or install it yourself as:
18
20
 
19
21
  ## Usage
20
22
 
21
- TODO: Write usage instructions here
23
+ Add this line to your application's application.js
24
+
25
+ //= requirejquery.handsontable.full
26
+ Add this line to your application's application.css
27
+
28
+ *= require jquery.handsontable.full
22
29
 
23
30
  ## Contributing
24
31
 
@@ -27,3 +34,8 @@ TODO: Write usage instructions here
27
34
  3. Commit your changes (`git commit -am 'Add some feature'`)
28
35
  4. Push to the branch (`git push origin my-new-feature`)
29
36
  5. Create new Pull Request
37
+
38
+
39
+ HI i will add more features in it to make handsontable more usefull in ruby on rails application .
40
+ Please give your response .
41
+ For know about handsontable please visit http://handsontable.com/ .
@@ -1,3 +1,3 @@
1
1
  module RailsHandsontable
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Handsontable 0.10.2
2
+ * Handsontable 0.10.3
3
3
  * Handsontable is a simple jQuery plugin for editable tables with basic copy-paste compatibility with Excel and Google Docs
4
4
  *
5
5
  * Copyright 2012, Marcin Warpechowski
6
6
  * Licensed under the MIT license.
7
7
  * http://handsontable.com/
8
8
  *
9
- * Date: Thu Jan 23 2014 23:06:23 GMT+0100 (CET)
9
+ * Date: Mon Feb 10 2014 14:15:11 GMT+0100 (CET)
10
10
  */
11
11
  /*jslint white: true, browser: true, plusplus: true, indent: 4, maxerr: 50 */
12
12
 
@@ -329,14 +329,14 @@ Handsontable.Core = function (rootElement, userSettings) {
329
329
  rlen = instance.countRows();
330
330
  if (rlen < priv.settings.minRows) {
331
331
  for (r = 0; r < priv.settings.minRows - rlen; r++) {
332
- datamap.createRow();
332
+ datamap.createRow(instance.countRows(), 1, true);
333
333
  }
334
334
  }
335
335
 
336
336
  //should I add empty rows to meet minSpareRows?
337
337
  if (emptyRows < priv.settings.minSpareRows) {
338
338
  for (; emptyRows < priv.settings.minSpareRows && instance.countRows() < priv.settings.maxRows; emptyRows++) {
339
- datamap.createRow();
339
+ datamap.createRow(instance.countRows(), 1, true);
340
340
  }
341
341
  }
342
342
 
@@ -346,14 +346,14 @@ Handsontable.Core = function (rootElement, userSettings) {
346
346
  //should I add empty cols to meet minCols?
347
347
  if (!priv.settings.columns && instance.countCols() < priv.settings.minCols) {
348
348
  for (; instance.countCols() < priv.settings.minCols; emptyCols++) {
349
- datamap.createCol();
349
+ datamap.createCol(instance.countCols(), 1, true);
350
350
  }
351
351
  }
352
352
 
353
353
  //should I add empty cols to meet minSpareCols?
354
354
  if (!priv.settings.columns && instance.dataType === 'array' && emptyCols < priv.settings.minSpareCols) {
355
355
  for (; emptyCols < priv.settings.minSpareCols && instance.countCols() < priv.settings.maxCols; emptyCols++) {
356
- datamap.createCol();
356
+ datamap.createCol(instance.countCols(), 1, true);
357
357
  }
358
358
  }
359
359
 
@@ -2271,7 +2271,7 @@ Handsontable.Core = function (rootElement, userSettings) {
2271
2271
  /**
2272
2272
  * Handsontable version
2273
2273
  */
2274
- this.version = '0.10.2'; //inserted by grunt from package.json
2274
+ this.version = '0.10.3'; //inserted by grunt from package.json
2275
2275
  };
2276
2276
 
2277
2277
  var DefaultSettings = function () {};
@@ -3635,7 +3635,26 @@ Handsontable.helper.proxy = function (fun, context) {
3635
3635
  };
3636
3636
  };
3637
3637
 
3638
- Handsontable.helper.cellMethodLookupFactory = function (methodName) {
3638
+ /**
3639
+ * Factory that produces a function for searching methods (or any properties) which could be defined directly in
3640
+ * table configuration or implicitly, within cell type definition.
3641
+ *
3642
+ * For example: renderer can be defined explicitly using "renderer" property in column configuration or it can be
3643
+ * defined implicitly using "type" property.
3644
+ *
3645
+ * Methods/properties defined explicitly always takes precedence over those defined through "type".
3646
+ *
3647
+ * If the method/property is not found in an object, searching is continued recursively through prototype chain, until
3648
+ * it reaches the Object.prototype.
3649
+ *
3650
+ *
3651
+ * @param methodName {String} name of the method/property to search (i.e. 'renderer', 'validator', 'copyable')
3652
+ * @param allowUndefined {Boolean} [optional] if false, the search is continued if methodName has not been found in cell "type"
3653
+ * @returns {Function}
3654
+ */
3655
+ Handsontable.helper.cellMethodLookupFactory = function (methodName, allowUndefined) {
3656
+
3657
+ allowUndefined = typeof allowUndefined == 'undefined' ? true : allowUndefined;
3639
3658
 
3640
3659
  return function cellMethodLookup (row, col) {
3641
3660
 
@@ -3660,7 +3679,12 @@ Handsontable.helper.cellMethodLookupFactory = function (methodName) {
3660
3679
 
3661
3680
  type = translateTypeNameToObject(properties.type);
3662
3681
 
3663
- return type[methodName]; //method defined in type. if does not exist (eg. validator), returns undefined
3682
+ if (type.hasOwnProperty(methodName)) {
3683
+ return type[methodName]; //method defined in type.
3684
+ } else if (allowUndefined) {
3685
+ return; //method does not defined in type (eg. validator), returns undefined
3686
+ }
3687
+
3664
3688
  }
3665
3689
 
3666
3690
  return getMethodFromProperties(Handsontable.helper.getPrototypeOf(properties));
@@ -3855,7 +3879,7 @@ Handsontable.SelectionPoint.prototype.arr = function (arr) {
3855
3879
  * Creates row at the bottom of the data array
3856
3880
  * @param {Number} [index] Optional. Index of the row before which the new row will be inserted
3857
3881
  */
3858
- Handsontable.DataMap.prototype.createRow = function (index, amount) {
3882
+ Handsontable.DataMap.prototype.createRow = function (index, amount, createdAutomatically) {
3859
3883
  var row
3860
3884
  , colCount = this.instance.countCols()
3861
3885
  , numberOfCreatedRows = 0
@@ -3898,7 +3922,7 @@ Handsontable.SelectionPoint.prototype.arr = function (arr) {
3898
3922
  }
3899
3923
 
3900
3924
 
3901
- this.instance.PluginHooks.run('afterCreateRow', index, numberOfCreatedRows);
3925
+ this.instance.PluginHooks.run('afterCreateRow', index, numberOfCreatedRows, createdAutomatically);
3902
3926
  this.instance.forceFullRender = true; //used when data was changed
3903
3927
 
3904
3928
  return numberOfCreatedRows;
@@ -3909,7 +3933,7 @@ Handsontable.SelectionPoint.prototype.arr = function (arr) {
3909
3933
  * @param {Number} [index] Optional. Index of the column before which the new column will be inserted
3910
3934
  * * @param {Number} [amount] Optional.
3911
3935
  */
3912
- Handsontable.DataMap.prototype.createCol = function (index, amount) {
3936
+ Handsontable.DataMap.prototype.createCol = function (index, amount, createdAutomatically) {
3913
3937
  if (this.instance.dataType === 'object' || this.instance.getSettings().columns) {
3914
3938
  throw new Error("Cannot create new column. When data source in an object, " +
3915
3939
  "you can only have as much columns as defined in first data row, data schema or in the 'columns' setting." +
@@ -3952,7 +3976,7 @@ Handsontable.SelectionPoint.prototype.arr = function (arr) {
3952
3976
  currentIndex++;
3953
3977
  }
3954
3978
 
3955
- this.instance.PluginHooks.run('afterCreateCol', index, numberOfCreatedCols);
3979
+ this.instance.PluginHooks.run('afterCreateCol', index, numberOfCreatedCols, createdAutomatically);
3956
3980
  this.instance.forceFullRender = true; //used when data was changed
3957
3981
 
3958
3982
  return numberOfCreatedCols;
@@ -4127,7 +4151,7 @@ Handsontable.SelectionPoint.prototype.arr = function (arr) {
4127
4151
  }
4128
4152
  };
4129
4153
 
4130
- var copyableLookup = Handsontable.helper.cellMethodLookupFactory('copyable');
4154
+ var copyableLookup = Handsontable.helper.cellMethodLookupFactory('copyable', false);
4131
4155
 
4132
4156
  /**
4133
4157
  * Returns single value from the data array (intended for clipboard copy to an external application)
@@ -5069,8 +5093,8 @@ Handsontable.SelectionPoint.prototype.arr = function (arr) {
5069
5093
  showButtonPanel: true,
5070
5094
  changeMonth: true,
5071
5095
  changeYear: true,
5072
- altField: this.$textarea,
5073
- onSelect: function () {
5096
+ onSelect: function (dateStr) {
5097
+ that.setValue(dateStr);
5074
5098
  that.finishEditing(false);
5075
5099
  }
5076
5100
  };
@@ -5360,10 +5384,13 @@ Handsontable.SelectionPoint.prototype.arr = function (arr) {
5360
5384
 
5361
5385
  hot.updateSettings({
5362
5386
  'colWidths': [this.wtDom.outerWidth(this.TEXTAREA) - 2],
5363
- afterRenderer: function (TD, row, col, prop, value, cellProperties) {
5364
- var match = TD.innerHTML.match(new RegExp(that.query, 'i'));
5365
- if(match){
5366
- TD.innerHTML = value.replace(match[0], '<strong>' + match[0] + '</strong>');
5387
+ afterRenderer: function (TD, row, col, prop, value) {
5388
+ var caseSensitive = this.getCellMeta(row, col).filteringCaseSensitive === true;
5389
+ var indexOfMatch = caseSensitive ? value.indexOf(that.query) : value.toLowerCase().indexOf(that.query.toLowerCase());
5390
+
5391
+ if(indexOfMatch != -1){
5392
+ var match = value.substr(indexOfMatch, that.query.length);
5393
+ TD.innerHTML = value.replace(match, '<strong>' + match + '</strong>');
5367
5394
  }
5368
5395
  }
5369
5396
  });
@@ -5430,10 +5457,17 @@ Handsontable.SelectionPoint.prototype.arr = function (arr) {
5430
5457
  choices = this.cellProperties.source;
5431
5458
  } else {
5432
5459
 
5433
- var queryRegex = new RegExp(query, this.cellProperties.filteringCaseSensitive === true ? '' : 'i');
5460
+ var filteringCaseSensitive = this.cellProperties.filteringCaseSensitive === true;
5461
+ var lowerCaseQuery = query.toLowerCase();
5434
5462
 
5435
5463
  choices = this.cellProperties.source.filter(function(choice){
5436
- return queryRegex.test(choice);
5464
+
5465
+ if (filteringCaseSensitive) {
5466
+ return choice.indexOf(query) != -1;
5467
+ } else {
5468
+ return choice.toLowerCase().indexOf(lowerCaseQuery) != -1;
5469
+ }
5470
+
5437
5471
  });
5438
5472
  }
5439
5473
 
@@ -5492,7 +5526,7 @@ Handsontable.SelectionPoint.prototype.arr = function (arr) {
5492
5526
 
5493
5527
  rowToHighlight = findItemIndexToHighlight(choices, value);
5494
5528
 
5495
- if ( typeof rowToHighlight == 'undefined'){
5529
+ if ( typeof rowToHighlight == 'undefined' && this.cellProperties.allowInvalid === false){
5496
5530
  rowToHighlight = 0;
5497
5531
  }
5498
5532
 
@@ -6920,26 +6954,26 @@ Handsontable.PluginHookClass = (function () {
6920
6954
  }
6921
6955
 
6922
6956
  PluginHookClass.prototype.add = function (key, fn) {
6923
- // provide support for old versions of HOT
6924
- if (key in legacy) {
6925
- key = legacy[key];
6926
- }
6927
-
6928
- if (typeof this.hooks[key] === "undefined") {
6929
- this.hooks[key] = [];
6930
- }
6931
-
6957
+ //if fn is array, run this for all the array items
6932
6958
  if (Handsontable.helper.isArray(fn)) {
6933
6959
  for (var i = 0, len = fn.length; i < len; i++) {
6934
- this.hooks[key].push(fn[i]);
6935
- }
6936
- } else {
6937
- if (this.hooks[key].indexOf(fn) > -1) {
6938
- throw new Error("Seems that you are trying to set the same plugin hook twice (" + key + ", " + fn + ")"); //error here should help writing bug-free plugins
6960
+ this.add(key, fn[i]);
6939
6961
  }
6940
- this.hooks[key].push(fn);
6941
6962
  }
6963
+ else {
6964
+ // provide support for old versions of HOT
6965
+ if (key in legacy) {
6966
+ key = legacy[key];
6967
+ }
6968
+
6969
+ if (typeof this.hooks[key] === "undefined") {
6970
+ this.hooks[key] = [];
6971
+ }
6942
6972
 
6973
+ if (this.hooks[key].indexOf(fn) == -1) {
6974
+ this.hooks[key].push(fn); //only add a hook if it has not already be added (adding the same hook twice is now silently ignored)
6975
+ }
6976
+ }
6943
6977
  return this;
6944
6978
  };
6945
6979
 
@@ -8908,7 +8942,12 @@ function Storage(prefix) {
8908
8942
  }
8909
8943
  });
8910
8944
 
8911
- instance.addHook("afterCreateRow", function (index, amount) {
8945
+ instance.addHook("afterCreateRow", function (index, amount, createdAutomatically) {
8946
+
8947
+ if (createdAutomatically) {
8948
+ return;
8949
+ }
8950
+
8912
8951
  var action = new Handsontable.UndoRedo.CreateRowAction(index, amount);
8913
8952
  plugin.done(action);
8914
8953
  });
@@ -8921,7 +8960,12 @@ function Storage(prefix) {
8921
8960
  plugin.done(action);
8922
8961
  });
8923
8962
 
8924
- instance.addHook("afterCreateCol", function (index, amount) {
8963
+ instance.addHook("afterCreateCol", function (index, amount, createdAutomatically) {
8964
+
8965
+ if (createdAutomatically) {
8966
+ return;
8967
+ }
8968
+
8925
8969
  var action = new Handsontable.UndoRedo.CreateColumnAction(index, amount);
8926
8970
  plugin.done(action);
8927
8971
  });
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Handsontable 0.10.2
2
+ * Handsontable 0.10.3
3
3
  * Handsontable is a simple jQuery plugin for editable tables with basic copy-paste compatibility with Excel and Google Docs
4
4
  *
5
5
  * Copyright 2012, Marcin Warpechowski
6
6
  * Licensed under the MIT license.
7
7
  * http://handsontable.com/
8
8
  *
9
- * Date: Thu Jan 23 2014 23:06:23 GMT+0100 (CET)
9
+ * Date: Mon Feb 10 2014 14:15:11 GMT+0100 (CET)
10
10
  */
11
11
  /*jslint white: true, browser: true, plusplus: true, indent: 4, maxerr: 50 */
12
12
 
@@ -329,14 +329,14 @@ Handsontable.Core = function (rootElement, userSettings) {
329
329
  rlen = instance.countRows();
330
330
  if (rlen < priv.settings.minRows) {
331
331
  for (r = 0; r < priv.settings.minRows - rlen; r++) {
332
- datamap.createRow();
332
+ datamap.createRow(instance.countRows(), 1, true);
333
333
  }
334
334
  }
335
335
 
336
336
  //should I add empty rows to meet minSpareRows?
337
337
  if (emptyRows < priv.settings.minSpareRows) {
338
338
  for (; emptyRows < priv.settings.minSpareRows && instance.countRows() < priv.settings.maxRows; emptyRows++) {
339
- datamap.createRow();
339
+ datamap.createRow(instance.countRows(), 1, true);
340
340
  }
341
341
  }
342
342
 
@@ -346,14 +346,14 @@ Handsontable.Core = function (rootElement, userSettings) {
346
346
  //should I add empty cols to meet minCols?
347
347
  if (!priv.settings.columns && instance.countCols() < priv.settings.minCols) {
348
348
  for (; instance.countCols() < priv.settings.minCols; emptyCols++) {
349
- datamap.createCol();
349
+ datamap.createCol(instance.countCols(), 1, true);
350
350
  }
351
351
  }
352
352
 
353
353
  //should I add empty cols to meet minSpareCols?
354
354
  if (!priv.settings.columns && instance.dataType === 'array' && emptyCols < priv.settings.minSpareCols) {
355
355
  for (; emptyCols < priv.settings.minSpareCols && instance.countCols() < priv.settings.maxCols; emptyCols++) {
356
- datamap.createCol();
356
+ datamap.createCol(instance.countCols(), 1, true);
357
357
  }
358
358
  }
359
359
 
@@ -2271,7 +2271,7 @@ Handsontable.Core = function (rootElement, userSettings) {
2271
2271
  /**
2272
2272
  * Handsontable version
2273
2273
  */
2274
- this.version = '0.10.2'; //inserted by grunt from package.json
2274
+ this.version = '0.10.3'; //inserted by grunt from package.json
2275
2275
  };
2276
2276
 
2277
2277
  var DefaultSettings = function () {};
@@ -3635,7 +3635,26 @@ Handsontable.helper.proxy = function (fun, context) {
3635
3635
  };
3636
3636
  };
3637
3637
 
3638
- Handsontable.helper.cellMethodLookupFactory = function (methodName) {
3638
+ /**
3639
+ * Factory that produces a function for searching methods (or any properties) which could be defined directly in
3640
+ * table configuration or implicitly, within cell type definition.
3641
+ *
3642
+ * For example: renderer can be defined explicitly using "renderer" property in column configuration or it can be
3643
+ * defined implicitly using "type" property.
3644
+ *
3645
+ * Methods/properties defined explicitly always takes precedence over those defined through "type".
3646
+ *
3647
+ * If the method/property is not found in an object, searching is continued recursively through prototype chain, until
3648
+ * it reaches the Object.prototype.
3649
+ *
3650
+ *
3651
+ * @param methodName {String} name of the method/property to search (i.e. 'renderer', 'validator', 'copyable')
3652
+ * @param allowUndefined {Boolean} [optional] if false, the search is continued if methodName has not been found in cell "type"
3653
+ * @returns {Function}
3654
+ */
3655
+ Handsontable.helper.cellMethodLookupFactory = function (methodName, allowUndefined) {
3656
+
3657
+ allowUndefined = typeof allowUndefined == 'undefined' ? true : allowUndefined;
3639
3658
 
3640
3659
  return function cellMethodLookup (row, col) {
3641
3660
 
@@ -3660,7 +3679,12 @@ Handsontable.helper.cellMethodLookupFactory = function (methodName) {
3660
3679
 
3661
3680
  type = translateTypeNameToObject(properties.type);
3662
3681
 
3663
- return type[methodName]; //method defined in type. if does not exist (eg. validator), returns undefined
3682
+ if (type.hasOwnProperty(methodName)) {
3683
+ return type[methodName]; //method defined in type.
3684
+ } else if (allowUndefined) {
3685
+ return; //method does not defined in type (eg. validator), returns undefined
3686
+ }
3687
+
3664
3688
  }
3665
3689
 
3666
3690
  return getMethodFromProperties(Handsontable.helper.getPrototypeOf(properties));
@@ -3855,7 +3879,7 @@ Handsontable.SelectionPoint.prototype.arr = function (arr) {
3855
3879
  * Creates row at the bottom of the data array
3856
3880
  * @param {Number} [index] Optional. Index of the row before which the new row will be inserted
3857
3881
  */
3858
- Handsontable.DataMap.prototype.createRow = function (index, amount) {
3882
+ Handsontable.DataMap.prototype.createRow = function (index, amount, createdAutomatically) {
3859
3883
  var row
3860
3884
  , colCount = this.instance.countCols()
3861
3885
  , numberOfCreatedRows = 0
@@ -3898,7 +3922,7 @@ Handsontable.SelectionPoint.prototype.arr = function (arr) {
3898
3922
  }
3899
3923
 
3900
3924
 
3901
- this.instance.PluginHooks.run('afterCreateRow', index, numberOfCreatedRows);
3925
+ this.instance.PluginHooks.run('afterCreateRow', index, numberOfCreatedRows, createdAutomatically);
3902
3926
  this.instance.forceFullRender = true; //used when data was changed
3903
3927
 
3904
3928
  return numberOfCreatedRows;
@@ -3909,7 +3933,7 @@ Handsontable.SelectionPoint.prototype.arr = function (arr) {
3909
3933
  * @param {Number} [index] Optional. Index of the column before which the new column will be inserted
3910
3934
  * * @param {Number} [amount] Optional.
3911
3935
  */
3912
- Handsontable.DataMap.prototype.createCol = function (index, amount) {
3936
+ Handsontable.DataMap.prototype.createCol = function (index, amount, createdAutomatically) {
3913
3937
  if (this.instance.dataType === 'object' || this.instance.getSettings().columns) {
3914
3938
  throw new Error("Cannot create new column. When data source in an object, " +
3915
3939
  "you can only have as much columns as defined in first data row, data schema or in the 'columns' setting." +
@@ -3952,7 +3976,7 @@ Handsontable.SelectionPoint.prototype.arr = function (arr) {
3952
3976
  currentIndex++;
3953
3977
  }
3954
3978
 
3955
- this.instance.PluginHooks.run('afterCreateCol', index, numberOfCreatedCols);
3979
+ this.instance.PluginHooks.run('afterCreateCol', index, numberOfCreatedCols, createdAutomatically);
3956
3980
  this.instance.forceFullRender = true; //used when data was changed
3957
3981
 
3958
3982
  return numberOfCreatedCols;
@@ -4127,7 +4151,7 @@ Handsontable.SelectionPoint.prototype.arr = function (arr) {
4127
4151
  }
4128
4152
  };
4129
4153
 
4130
- var copyableLookup = Handsontable.helper.cellMethodLookupFactory('copyable');
4154
+ var copyableLookup = Handsontable.helper.cellMethodLookupFactory('copyable', false);
4131
4155
 
4132
4156
  /**
4133
4157
  * Returns single value from the data array (intended for clipboard copy to an external application)
@@ -5069,8 +5093,8 @@ Handsontable.SelectionPoint.prototype.arr = function (arr) {
5069
5093
  showButtonPanel: true,
5070
5094
  changeMonth: true,
5071
5095
  changeYear: true,
5072
- altField: this.$textarea,
5073
- onSelect: function () {
5096
+ onSelect: function (dateStr) {
5097
+ that.setValue(dateStr);
5074
5098
  that.finishEditing(false);
5075
5099
  }
5076
5100
  };
@@ -5360,10 +5384,13 @@ Handsontable.SelectionPoint.prototype.arr = function (arr) {
5360
5384
 
5361
5385
  hot.updateSettings({
5362
5386
  'colWidths': [this.wtDom.outerWidth(this.TEXTAREA) - 2],
5363
- afterRenderer: function (TD, row, col, prop, value, cellProperties) {
5364
- var match = TD.innerHTML.match(new RegExp(that.query, 'i'));
5365
- if(match){
5366
- TD.innerHTML = value.replace(match[0], '<strong>' + match[0] + '</strong>');
5387
+ afterRenderer: function (TD, row, col, prop, value) {
5388
+ var caseSensitive = this.getCellMeta(row, col).filteringCaseSensitive === true;
5389
+ var indexOfMatch = caseSensitive ? value.indexOf(that.query) : value.toLowerCase().indexOf(that.query.toLowerCase());
5390
+
5391
+ if(indexOfMatch != -1){
5392
+ var match = value.substr(indexOfMatch, that.query.length);
5393
+ TD.innerHTML = value.replace(match, '<strong>' + match + '</strong>');
5367
5394
  }
5368
5395
  }
5369
5396
  });
@@ -5430,10 +5457,17 @@ Handsontable.SelectionPoint.prototype.arr = function (arr) {
5430
5457
  choices = this.cellProperties.source;
5431
5458
  } else {
5432
5459
 
5433
- var queryRegex = new RegExp(query, this.cellProperties.filteringCaseSensitive === true ? '' : 'i');
5460
+ var filteringCaseSensitive = this.cellProperties.filteringCaseSensitive === true;
5461
+ var lowerCaseQuery = query.toLowerCase();
5434
5462
 
5435
5463
  choices = this.cellProperties.source.filter(function(choice){
5436
- return queryRegex.test(choice);
5464
+
5465
+ if (filteringCaseSensitive) {
5466
+ return choice.indexOf(query) != -1;
5467
+ } else {
5468
+ return choice.toLowerCase().indexOf(lowerCaseQuery) != -1;
5469
+ }
5470
+
5437
5471
  });
5438
5472
  }
5439
5473
 
@@ -5492,7 +5526,7 @@ Handsontable.SelectionPoint.prototype.arr = function (arr) {
5492
5526
 
5493
5527
  rowToHighlight = findItemIndexToHighlight(choices, value);
5494
5528
 
5495
- if ( typeof rowToHighlight == 'undefined'){
5529
+ if ( typeof rowToHighlight == 'undefined' && this.cellProperties.allowInvalid === false){
5496
5530
  rowToHighlight = 0;
5497
5531
  }
5498
5532
 
@@ -6920,26 +6954,26 @@ Handsontable.PluginHookClass = (function () {
6920
6954
  }
6921
6955
 
6922
6956
  PluginHookClass.prototype.add = function (key, fn) {
6923
- // provide support for old versions of HOT
6924
- if (key in legacy) {
6925
- key = legacy[key];
6926
- }
6927
-
6928
- if (typeof this.hooks[key] === "undefined") {
6929
- this.hooks[key] = [];
6930
- }
6931
-
6957
+ //if fn is array, run this for all the array items
6932
6958
  if (Handsontable.helper.isArray(fn)) {
6933
6959
  for (var i = 0, len = fn.length; i < len; i++) {
6934
- this.hooks[key].push(fn[i]);
6935
- }
6936
- } else {
6937
- if (this.hooks[key].indexOf(fn) > -1) {
6938
- throw new Error("Seems that you are trying to set the same plugin hook twice (" + key + ", " + fn + ")"); //error here should help writing bug-free plugins
6960
+ this.add(key, fn[i]);
6939
6961
  }
6940
- this.hooks[key].push(fn);
6941
6962
  }
6963
+ else {
6964
+ // provide support for old versions of HOT
6965
+ if (key in legacy) {
6966
+ key = legacy[key];
6967
+ }
6968
+
6969
+ if (typeof this.hooks[key] === "undefined") {
6970
+ this.hooks[key] = [];
6971
+ }
6942
6972
 
6973
+ if (this.hooks[key].indexOf(fn) == -1) {
6974
+ this.hooks[key].push(fn); //only add a hook if it has not already be added (adding the same hook twice is now silently ignored)
6975
+ }
6976
+ }
6943
6977
  return this;
6944
6978
  };
6945
6979
 
@@ -8908,7 +8942,12 @@ function Storage(prefix) {
8908
8942
  }
8909
8943
  });
8910
8944
 
8911
- instance.addHook("afterCreateRow", function (index, amount) {
8945
+ instance.addHook("afterCreateRow", function (index, amount, createdAutomatically) {
8946
+
8947
+ if (createdAutomatically) {
8948
+ return;
8949
+ }
8950
+
8912
8951
  var action = new Handsontable.UndoRedo.CreateRowAction(index, amount);
8913
8952
  plugin.done(action);
8914
8953
  });
@@ -8921,7 +8960,12 @@ function Storage(prefix) {
8921
8960
  plugin.done(action);
8922
8961
  });
8923
8962
 
8924
- instance.addHook("afterCreateCol", function (index, amount) {
8963
+ instance.addHook("afterCreateCol", function (index, amount, createdAutomatically) {
8964
+
8965
+ if (createdAutomatically) {
8966
+ return;
8967
+ }
8968
+
8925
8969
  var action = new Handsontable.UndoRedo.CreateColumnAction(index, amount);
8926
8970
  plugin.done(action);
8927
8971
  });
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Handsontable 0.10.2
2
+ * Handsontable 0.10.3
3
3
  * Handsontable is a simple jQuery plugin for editable tables with basic copy-paste compatibility with Excel and Google Docs
4
4
  *
5
5
  * Copyright 2012, Marcin Warpechowski
6
6
  * Licensed under the MIT license.
7
7
  * http://handsontable.com/
8
8
  *
9
- * Date: Thu Jan 23 2014 23:06:23 GMT+0100 (CET)
9
+ * Date: Mon Feb 10 2014 14:15:11 GMT+0100 (CET)
10
10
  */
11
11
 
12
12
  .handsontable {
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Handsontable 0.10.2
2
+ * Handsontable 0.10.3
3
3
  * Handsontable is a simple jQuery plugin for editable tables with basic copy-paste compatibility with Excel and Google Docs
4
4
  *
5
5
  * Copyright 2012, Marcin Warpechowski
6
6
  * Licensed under the MIT license.
7
7
  * http://handsontable.com/
8
8
  *
9
- * Date: Thu Jan 23 2014 23:06:23 GMT+0100 (CET)
9
+ * Date: Mon Feb 10 2014 14:15:11 GMT+0100 (CET)
10
10
  */
11
11
 
12
12
  .handsontable {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_handsontable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: