gridx-rails 1.1.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +8 -8
  2. data/README.md +3 -3
  3. data/app/assets/javascripts/gridx/Grid.js +3 -2
  4. data/app/assets/javascripts/gridx/core/model/cache/_Cache.js +25 -8
  5. data/app/assets/javascripts/gridx/modules/Bar.js +1 -2
  6. data/app/assets/javascripts/gridx/modules/Body.js +15 -7
  7. data/app/assets/javascripts/gridx/modules/CellWidget.js +8 -4
  8. data/app/assets/javascripts/gridx/modules/ColumnLock.js +12 -12
  9. data/app/assets/javascripts/gridx/modules/ColumnResizer.js +9 -10
  10. data/app/assets/javascripts/gridx/modules/Dod.js +1 -0
  11. data/app/assets/javascripts/gridx/modules/Edit.js +18 -15
  12. data/app/assets/javascripts/gridx/modules/Filter.js +7 -3
  13. data/app/assets/javascripts/gridx/modules/Focus.js +45 -36
  14. data/app/assets/javascripts/gridx/modules/GroupHeader.js +2 -1
  15. data/app/assets/javascripts/gridx/modules/HLayout.js +1 -0
  16. data/app/assets/javascripts/gridx/modules/HScroller.js +1 -0
  17. data/app/assets/javascripts/gridx/modules/Header.js +8 -1
  18. data/app/assets/javascripts/gridx/modules/HeaderMenu.js +1 -0
  19. data/app/assets/javascripts/gridx/modules/HeaderRegions.js +2 -1
  20. data/app/assets/javascripts/gridx/modules/IndirectSelect.js +7 -34
  21. data/app/assets/javascripts/gridx/modules/IndirectSelectColumn.js +4 -13
  22. data/app/assets/javascripts/gridx/modules/Menu.js +5 -1
  23. data/app/assets/javascripts/gridx/modules/NavigableCell.js +3 -1
  24. data/app/assets/javascripts/gridx/modules/NestedSort.js +4 -1
  25. data/app/assets/javascripts/gridx/modules/Pagination.js +1 -0
  26. data/app/assets/javascripts/gridx/modules/Persist.js +1 -0
  27. data/app/assets/javascripts/gridx/modules/RowHeader.js +11 -10
  28. data/app/assets/javascripts/gridx/modules/SingleSort.js +1 -0
  29. data/app/assets/javascripts/gridx/modules/SummaryBar.js +1 -0
  30. data/app/assets/javascripts/gridx/modules/ToolBar.js +3 -0
  31. data/app/assets/javascripts/gridx/modules/TouchScroll.js +1 -0
  32. data/app/assets/javascripts/gridx/modules/TouchVScroller.js +28 -5
  33. data/app/assets/javascripts/gridx/modules/Traverse.js +1 -0
  34. data/app/assets/javascripts/gridx/modules/Tree.js +2 -1
  35. data/app/assets/javascripts/gridx/modules/VLayout.js +1 -0
  36. data/app/assets/javascripts/gridx/modules/VScroller.js +22 -11
  37. data/app/assets/javascripts/gridx/modules/View.js +11 -6
  38. data/app/assets/javascripts/gridx/modules/VirtualVScroller.js +8 -4
  39. data/app/assets/javascripts/gridx/modules/dnd/Column.js +3 -4
  40. data/app/assets/javascripts/gridx/modules/dnd/Row.js +3 -4
  41. data/app/assets/javascripts/gridx/modules/dnd/_Dnd.js +1 -0
  42. data/app/assets/javascripts/gridx/modules/extendedSelect/Cell.js +4 -3
  43. data/app/assets/javascripts/gridx/modules/extendedSelect/Column.js +6 -7
  44. data/app/assets/javascripts/gridx/modules/extendedSelect/Row.js +33 -15
  45. data/app/assets/javascripts/gridx/modules/filter/FilterBar.js +9 -7
  46. data/app/assets/javascripts/gridx/modules/filter/FilterDialog.js +1 -1
  47. data/app/assets/javascripts/gridx/modules/filter/FilterPane.js +1 -1
  48. data/app/assets/javascripts/gridx/modules/filter/QuickFilter.js +1 -0
  49. data/app/assets/javascripts/gridx/modules/move/Column.js +2 -1
  50. data/app/assets/javascripts/gridx/modules/move/Row.js +2 -1
  51. data/app/assets/javascripts/gridx/modules/pagination/PaginationBar.js +1 -0
  52. data/app/assets/javascripts/gridx/modules/pagination/PaginationBarDD.js +2 -0
  53. data/app/assets/javascripts/gridx/modules/select/Cell.js +10 -7
  54. data/app/assets/javascripts/gridx/modules/select/Column.js +3 -2
  55. data/app/assets/javascripts/gridx/modules/select/Row.js +27 -13
  56. data/app/assets/javascripts/gridx/support/QuickFilter.js +7 -2
  57. data/lib/gridx-rails/version.rb +1 -1
  58. data/test/dummy/log/test.log +5 -0
  59. metadata +2 -2
@@ -200,6 +200,7 @@ define([
200
200
  cssName: p._cssName,
201
201
  count: p._getDndCount()
202
202
  };
203
+ t.grid.vScrollerNode.focus();
203
204
  p._onBeginDnd(t._source);
204
205
  dom.setSelectable(t.grid.domNode, false);
205
206
  }
@@ -30,6 +30,7 @@ define([
30
30
 
31
31
  return declare(_RowCellBase, {
32
32
  // summary:
33
+ // module name: selectCell.
33
34
  // Provides advanced cell selections.
34
35
  // description:
35
36
  // This module provides an advanced way for selecting cells by clicking, swiping, SPACE key, or CTRL/SHIFT CLICK to select multiple cell.
@@ -251,7 +252,7 @@ define([
251
252
  if(mouse.isLeft(e) && (
252
253
  !domClass.contains(e.target, 'gridxTreeExpandoIcon') &&
253
254
  !domClass.contains(e.target, 'gridxTreeExpandoInner'))){
254
- t._start(createItem(e.rowId, e.visualIndex, e.columnId, e.columnIndex), g._isCopyEvent(e), e.shiftKey);
255
+ t._start(createItem(e.rowId, e.visualIndex, e.columnId, e.columnIndex), g._isCtrlKey(e), e.shiftKey);
255
256
  if(!e.shiftKey && !t.arg('canSwept')){
256
257
  t._end();
257
258
  }
@@ -263,7 +264,7 @@ define([
263
264
  [g, has('ff') < 4 ? 'onCellKeyUp' : 'onCellKeyDown', function(e){
264
265
  if(e.keyCode === keys.SPACE && (!g.focus || g.focus.currentArea() == 'body')){
265
266
  event.stop(e);
266
- t._start(createItem(e.rowId, e.visualIndex, e.columnId, e.columnIndex), g._isCopyEvent(e), e.shiftKey);
267
+ t._start(createItem(e.rowId, e.visualIndex, e.columnId, e.columnIndex), g._isCtrlKey(e), e.shiftKey);
267
268
  t._end();
268
269
  }
269
270
  }]
@@ -313,7 +314,7 @@ define([
313
314
  g = t.grid,
314
315
  rid = t._getRowId(rowVisIndex),
315
316
  cid = g._columns[colIndex].id;
316
- t._start(createItem(rid, rowVisIndex, cid, colIndex), g._isCopyEvent(e), 1); //1 as true
317
+ t._start(createItem(rid, rowVisIndex, cid, colIndex), g._isCtrlKey(e), 1); //1 as true
317
318
  t._end();
318
319
  }
319
320
  },
@@ -29,6 +29,7 @@ define([
29
29
 
30
30
  return declare(_Base, {
31
31
  // summary:
32
+ // module name: selectColumn.
32
33
  // Provides advanced column selections.
33
34
  // description:
34
35
  // This module provides an advanced way for selecting columns by clicking, swiping, SPACE key, or CTRL/SHIFT CLICK to select multiple columns.
@@ -192,7 +193,7 @@ define([
192
193
  t.batchConnect(
193
194
  [g, 'onHeaderCellMouseDown', function(e){
194
195
  if(mouse.isLeft(e) && !domClass.contains(e.target, 'gridxArrowButtonNode')){
195
- t._start({column: e.columnIndex}, g._isCopyEvent(e), e.shiftKey);
196
+ t._start({column: e.columnIndex}, g._isCtrlKey(e), e.shiftKey);
196
197
  if(!e.shiftKey && !t.arg('canSwept')){
197
198
  t._end();
198
199
  }
@@ -207,7 +208,7 @@ define([
207
208
  [g, has('ff') < 4 ? 'onHeaderCellKeyUp' : 'onHeaderCellKeyDown', function(e){
208
209
  if((e.keyCode == keys.SPACE || e.keyCode == keys.ENTER) && !domClass.contains(e.target, 'gridxArrowButtonNode')){
209
210
  event.stop(e);
210
- t._start({column: e.columnIndex}, g._isCopyEvent(e), e.shiftKey);
211
+ t._start({column: e.columnIndex}, g._isCtrlKey(e), e.shiftKey);
211
212
  t._end();
212
213
  }
213
214
  }],
@@ -232,7 +233,7 @@ define([
232
233
  _onMoveToHeaderCell: function(columnId, e){
233
234
  if(e.shiftKey && (e.keyCode == keys.LEFT_ARROW || e.keyCode == keys.RIGHT_ARROW)){
234
235
  var t = this, col = t.grid._columnsById[columnId];
235
- t._start({column: col.index}, t.grid._isCopyEvent(e), 1); //1 as true
236
+ t._start({column: col.index}, t.grid._isCtrlKey(e), 1); //1 as true
236
237
  t._end();
237
238
  }
238
239
  },
@@ -243,13 +244,11 @@ define([
243
244
  },
244
245
 
245
246
  _beginAutoScroll: function(){
246
- var autoScroll = this.grid.autoScroll;
247
- this._autoScrollV = autoScroll.vertical;
248
- autoScroll.vertical = false;
247
+ this.grid.autoScroll.vertical = false;
249
248
  },
250
249
 
251
250
  _endAutoScroll: function(){
252
- this.grid.autoScroll.vertical = this._autoScrollV;
251
+ this.grid.autoScroll.vertical = true;
253
252
  },
254
253
 
255
254
  _doHighlight: function(target, toHighlight){
@@ -38,6 +38,7 @@ define([
38
38
 
39
39
  return declare(_RowCellBase, {
40
40
  // summary:
41
+ // module name: selectRow.
41
42
  // Provides advanced row selections.
42
43
  // description:
43
44
  // This module provides an advanced way for selecting rows by clicking, swiping, SPACE key, or CTRL/SHIFT CLICK to select multiple rows.
@@ -235,22 +236,41 @@ define([
235
236
  //Use special types to make filtered out rows unselected
236
237
  t.model._spTypes.select = 1; //1 as true
237
238
  t.model.setMarkable(lang.hitch(t, t._isSelectable));
239
+ function canSelect(e){
240
+ if(e.columnId && t.arg('triggerOnCell')){
241
+ return g._columnsById[e.columnId].rowSelectable !== false &&
242
+ !domClass.contains(e.target, 'gridxTreeExpandoIcon') &&
243
+ !domClass.contains(e.target, 'gridxTreeExpandoInner');
244
+ }
245
+ return !e.columnId;
246
+ }
238
247
  t.batchConnect(
239
248
  g.rowHeader && [g.rowHeader, 'onMoveToRowHeaderCell', '_onMoveToRowHeaderCell'],
240
249
  [g, 'onRowMouseDown', function(e){
241
- if(mouse.isLeft(e) && ((t.arg('triggerOnCell') &&
242
- !domClass.contains(e.target, 'gridxTreeExpandoIcon') &&
243
- !domClass.contains(e.target, 'gridxTreeExpandoInner')) || !e.columnId)){
250
+ if(mouse.isLeft(e) && canSelect(e)){
244
251
  t._isOnCell = e.columnId;
245
252
  if(t._isOnCell){
246
253
  g.body._focusCellCol = e.columnIndex;
247
254
  }
248
- t._start({row: e.visualIndex}, g._isCopyEvent(e), e.shiftKey);
255
+ t._start({row: e.visualIndex}, g._isCtrlKey(e), e.shiftKey);
249
256
  if(!e.shiftKey && !t.arg('canSwept')){
250
257
  t._end();
251
258
  }
252
259
  }
253
260
  }],
261
+ [g, 'onRowTouchStart', function(e){
262
+ if(canSelect(e)){
263
+ t._isOnCell = e.columnId;
264
+ if(t._isOnCell){
265
+ g.body._focusCellCol = e.columnIndex;
266
+ }
267
+ t._start({row: e.visualIndex}, g._isCtrlKey(e) || e.columnId === '__indirectSelect__', e.shiftKey);
268
+ if(!e.shiftKey && !t.arg('canSwept')){
269
+ t._end();
270
+ }
271
+ }
272
+ }],
273
+ [g, 'onRowTouchEnd', '_end'],
254
274
  [g.body, 'onAfterRow', function(row){
255
275
  var unselectable = !row.isSelectable();
256
276
  domClass.toggle(row.node(), 'gridxRowUnselectable', unselectable);
@@ -268,11 +288,11 @@ define([
268
288
  (t.arg('triggerOnCell') && (!g.focus || g.focus.currentArea() == 'body')))){
269
289
  event.stop(e);
270
290
  t._isOnCell = e.columnId;
271
- t._start({row: e.visualIndex}, g._isCopyEvent(e), e.shiftKey);
291
+ t._start({row: e.visualIndex}, g._isCtrlKey(e), e.shiftKey);
272
292
  t._end();
273
293
  }
274
294
  }],
275
- [g, 'setStore', '_syncMarkable']);
295
+ [g.model, 'setStore', '_syncUnselectable']);
276
296
  },
277
297
 
278
298
  _markById: function(args, toSelect){
@@ -343,14 +363,14 @@ define([
343
363
  _onMoveToCell: function(rowVisIndex, colIndex, e){
344
364
  var t = this;
345
365
  if(t.arg('triggerOnCell') && e.shiftKey && (e.keyCode == keys.UP_ARROW || e.keyCode == keys.DOWN_ARROW)){
346
- t._start({row: rowVisIndex}, t.grid._isCopyEvent(e), 1); //1 as true
366
+ t._start({row: rowVisIndex}, t.grid._isCtrlKey(e), 1); //1 as true
347
367
  t._end();
348
368
  }
349
369
  },
350
370
 
351
371
  _onMoveToRowHeaderCell: function(rowVisIndex, e){
352
372
  if(e.shiftKey){
353
- this._start({row: rowVisIndex}, this.grid._isCopyEvent(e), 1); //1 as true
373
+ this._start({row: rowVisIndex}, this.grid._isCtrlKey(e), 1); //1 as true
354
374
  this._end();
355
375
  }
356
376
  },
@@ -362,13 +382,11 @@ define([
362
382
  },
363
383
 
364
384
  _beginAutoScroll: function(){
365
- var autoScroll = this.grid.autoScroll;
366
- this._autoScrollH = autoScroll.horizontal;
367
- autoScroll.horizontal = false;
385
+ this.grid.autoScroll.horizontal = false;
368
386
  },
369
387
 
370
388
  _endAutoScroll: function(){
371
- this.grid.autoScroll.horizontal = this._autoScrollH;
389
+ this.grid.autoScroll.horizontal = true;
372
390
  },
373
391
 
374
392
  _doHighlight: function(target, toHighlight){
@@ -447,12 +465,12 @@ define([
447
465
  this._doHighlight(target, toHighlight);
448
466
  },
449
467
 
450
- _syncMarkable: function(){
468
+ _syncUnselectable: function(){
451
469
  var t = this,
452
- unselectable = this.arg('unselectable');
470
+ unselectable = t.arg('unselectable');
453
471
  for(var id in unselectable){
454
472
  t.model.setMarkable(id, !unselectable[id]);
455
- }
473
+ }
456
474
  }
457
475
  });
458
476
  });
@@ -28,6 +28,7 @@ define([
28
28
  /*=====
29
29
  var FilterBar = declare(_Module, {
30
30
  // summary:
31
+ // module name: filterBar.
31
32
  // Filter bar module.
32
33
  // description:
33
34
  // Show a filter bar on top of grid header. Clicking the filter bar will show a filter dialog to config conditions.
@@ -219,6 +220,10 @@ define([
219
220
  this.connect(this.domNode, 'onmouseover', 'onDomMouseOver');
220
221
  this.connect(this.domNode, 'onmousemove', 'onDomMouseMove');
221
222
  this.connect(this.domNode, 'onmouseout', 'onDomMouseOut');
223
+ this.aspect(this.grid.model, 'setStore', function(){
224
+ this.filterData = null;
225
+ this._buildFilterState();
226
+ });
222
227
  this.loaded.callback();
223
228
  },
224
229
  onDomClick: function(e){
@@ -269,7 +274,7 @@ define([
269
274
  this.grid.filter.setFilter(filter);
270
275
  this.model.when({}).then(function(){
271
276
  _this._currentSize = _this.model.size();
272
- _this._totalSize = _this.model._cache.size();
277
+ _this._totalSize = _this.model._cache.totalSize >= 0 ? _this.model._cache.totalSize : _this.model._cache.size();
273
278
  _this._buildFilterState();
274
279
  });
275
280
  },
@@ -336,12 +341,9 @@ define([
336
341
  refresh: function(){
337
342
  this.btnClose.style.display = this.closeButton ? '': 'none';
338
343
  this.btnFilter.domNode.style.display = this.arg('defineFilterButton') ? '': 'none';
339
- var _this = this;
340
- this.model.when({}).then(function(){
341
- _this._currentSize = _this.model.size();
342
- _this._totalSize = _this.model._cache.size();
343
- _this._buildFilterState();
344
- });
344
+ this._currentSize = this.model.size();
345
+ this._totalSize = this.model._cache.totalSize >= 0 ? this.model._cache.totalSize : this.model._cache.size();
346
+ this._buildFilterState();
345
347
  },
346
348
  isVisible: function(){
347
349
  return this.domNode.style.display != 'none';
@@ -114,7 +114,7 @@ define([
114
114
  }catch(e){}
115
115
  css.toggle(ac.domNode, 'gridxFilterSingleRule', ac.getChildren().length === 1);
116
116
 
117
- fp.connect(fp, 'onChange', lang.hitch(this, '_updateButtons'));
117
+ this.connect(fp, 'onChange', '_updateButtons');
118
118
  this._updateButtons();
119
119
  this._updateAccordionContainerHeight();
120
120
  //scroll to bottom when add a rule
@@ -277,7 +277,7 @@ define([
277
277
  case 'Text':
278
278
  return (combo ? this.comboText : this.tbSingle).get('value') || null;
279
279
  case 'Number':
280
- return isNaN(this.tbNumber.get('value')) ? null : this.tbNumber.get('value');
280
+ return (isNaN(this.tbNumber.get('value')) || !this.tbNumber.isValid())? null : this.tbNumber.get('value');
281
281
  case 'Select':
282
282
  return this.sltSingle.get('value') || null;
283
283
  case 'Date':
@@ -8,6 +8,7 @@ define([
8
8
  /*=====
9
9
  return declare(_Module, {
10
10
  // summary:
11
+ // module name: quickFilter.
11
12
  // Directly show gridx/support/QuickFilter in gridx/modules/Bar at the top/right position.
12
13
  // description:
13
14
  // This module is only for convenience. For other positions or more configurations, please use gridx/modules/Bar directly.
@@ -17,6 +17,7 @@ define([
17
17
 
18
18
  return declare(_Module, {
19
19
  // summary:
20
+ // module name: moveColumn.
20
21
  // This module provides several APIs to move columns within grid.
21
22
  // description:
22
23
  // This module does not include any UI. So different kind of column dnd UI implementations can be built
@@ -193,7 +194,7 @@ define([
193
194
  ltr = g.isLeftToRight(),
194
195
  preKey = ltr ? keys.LEFT_ARROW : keys.RIGHT_ARROW,
195
196
  postKey = ltr ? keys.RIGHT_ARROW : keys.LEFT_ARROW;
196
- if(e.ctrlKey && !e.shiftKey && !e.altKey && (e.keyCode == preKey || e.keyCode == postKey)){
197
+ if(g._isCtrlKey(e) && !e.shiftKey && !e.altKey && (e.keyCode == preKey || e.keyCode == postKey)){
197
198
  var target = e.columnIndex,
198
199
  colIdxes = selector && selector.isSelected(e.columnId) ?
199
200
  array.map(selector.getSelected(), function(id){
@@ -13,6 +13,7 @@ define([
13
13
 
14
14
  return declare(_Module, {
15
15
  // summary:
16
+ // module name: moveRow.
16
17
  // This module provides some APIs to move rows within grid
17
18
  // description:
18
19
  // This module requires the "Move" model extension.
@@ -118,7 +119,7 @@ define([
118
119
  var t = this,
119
120
  g = t.grid,
120
121
  selector = g.select && g.select.row;
121
- if(e.ctrlKey && !e.shiftKey && !e.altKey && (e.keyCode == keys.UP_ARROW || e.keyCode == keys.DOWN_ARROW)){
122
+ if(g._isCtrlKey(e) && !e.shiftKey && !e.altKey && (e.keyCode == keys.UP_ARROW || e.keyCode == keys.DOWN_ARROW)){
122
123
  var target = e.rowIndex,
123
124
  doMove = function(rowIdxes){
124
125
  if(e.keyCode == keys.UP_ARROW){
@@ -10,6 +10,7 @@ define([
10
10
  /*=====
11
11
  return declare(_PaginationBarBase, {
12
12
  // summary:
13
+ // module name: paginationBar.
13
14
  // Show link button pagination bar at the bottom of grid.
14
15
  // description:
15
16
  // This module directly uses gridx/modules/Bar to show gridx/support/Summary, gridx/support/LinkPager, gridx/support/LinkSizer,
@@ -8,6 +8,8 @@ define([
8
8
 
9
9
  /*=====
10
10
  return declare(_PaginationBarBase, {
11
+ // summary:
12
+ // module name: paginationBar.
11
13
  });
12
14
  =====*/
13
15
 
@@ -26,6 +26,7 @@ define([
26
26
 
27
27
  return declare(_RowCellBase, {
28
28
  // summary:
29
+ // module name: selectCell.
29
30
  // Provides simple cell selection.
30
31
  // description:
31
32
  // This module provides a simple way for selecting cells by clicking or SPACE key, or CTRL + Click to select multiple cells.
@@ -163,16 +164,18 @@ define([
163
164
  var t = this,
164
165
  g = t.grid;
165
166
  t.inherited(arguments);
167
+ var doSelect = function(e){
168
+ if(!domClass.contains(e.target, 'gridxTreeExpandoIcon') &&
169
+ !domClass.contains(e.target, 'gridxTreeExpandoInner')){
170
+ t._select([e.rowId, e.columnId], g._isCtrlKey(e));
171
+ }
172
+ };
166
173
  t.batchConnect(
167
- [g, 'onCellClick', function(e){
168
- if(!domClass.contains(e.target, 'gridxTreeExpandoIcon') &&
169
- !domClass.contains(e.target, 'gridxTreeExpandoInner')){
170
- t._select([e.rowId, e.columnId], g._isCopyEvent(e));
171
- }
172
- }],
174
+ [g, 'onCellClick', doSelect],
175
+ [g, 'onCellTouchStart', doSelect],
173
176
  [g, has('ff') < 4 ? 'onCellKeyUp' : 'onCellKeyDown', function(e){
174
177
  if(e.keyCode == keys.SPACE && (!g.focus || g.focus.currentArea() == 'body')){
175
- t._select([e.rowId, e.columnId], g._isCopyEvent(e));
178
+ t._select([e.rowId, e.columnId], g._isCtrlKey(e));
176
179
  event.stop(e);
177
180
  }
178
181
  }]);
@@ -27,6 +27,7 @@ define([
27
27
 
28
28
  return declare(_Base, {
29
29
  // summary:
30
+ // module name: selectColumn.
30
31
  // Provides simple column selection.
31
32
  // description:
32
33
  // This module provides a simple way for selecting columns by clicking or SPACE key,
@@ -157,12 +158,12 @@ define([
157
158
  t.batchConnect(
158
159
  [g, 'onHeaderCellClick', function(e){
159
160
  if(!domClass.contains(e.target, 'gridxArrowButtonNode')){
160
- t._select(e.columnId, g._isCopyEvent(e));
161
+ t._select(e.columnId, g._isCtrlKey(e));
161
162
  }
162
163
  }],
163
164
  [g, has('ff') < 4 ? 'onHeaderCellKeyUp' : 'onHeaderCellKeyDown', function(e){
164
165
  if(e.keyCode == keys.SPACE || e.keyCode == keys.ENTER){
165
- t._select(e.columnId, g._isCopyEvent(e));
166
+ t._select(e.columnId, g._isCtrlKey(e));
166
167
  event.stop(e);
167
168
  }
168
169
  }]
@@ -36,6 +36,7 @@ define([
36
36
 
37
37
  return declare(_RowCellBase, {
38
38
  // summary:
39
+ // module name: selectRow.
39
40
  // Provides simple row selection.
40
41
  // description:
41
42
  // This module provides a simple way for selecting rows by clicking or SPACE key, or CTRL + Click to select multiple rows.
@@ -215,14 +216,24 @@ define([
215
216
  t.inherited(arguments);
216
217
  t.model._spTypes.select = 1;
217
218
  t.model.setMarkable(lang.hitch(t, '_isSelectable'));
219
+ function canSelect(e){
220
+ if(e.columnId && t.arg('triggerOnCell')){
221
+ return g._columnsById[e.columnId].rowSelectable !== false &&
222
+ !domClass.contains(e.target, 'gridxTreeExpandoIcon') &&
223
+ !domClass.contains(e.target, 'gridxTreeExpandoInner');
224
+ }
225
+ return !e.columnId;
226
+ }
218
227
  t.batchConnect(
219
- [g, 'onRowClick', function(e){
228
+ [g, 'onRowMouseDown', function(e){
220
229
  //Have to check whether we are on the
221
- if((t.arg('triggerOnCell') &&
222
- !domClass.contains(e.target, 'gridxTreeExpandoIcon') &&
223
- !domClass.contains(e.target, 'gridxTreeExpandoInner')) ||
224
- !e.columnId){
225
- t._select(e.rowId, g._isCopyEvent(e));
230
+ if(canSelect(e)){
231
+ t._select(e.rowId, g._isCtrlKey(e));
232
+ }
233
+ }],
234
+ [g, 'onRowTouchStart', function(e){
235
+ if(canSelect(e)){
236
+ t._select(e.rowId, g._isCtrlKey(e) || e.columnId === '__indirectSelect__');
226
237
  }
227
238
  }],
228
239
  [g.body, 'onAfterRow', function(row){
@@ -230,15 +241,18 @@ define([
230
241
  domClass.toggle(row.node(), 'gridxRowUnselectable', unselectable);
231
242
  }],
232
243
  [g, has('ff') < 4 ? 'onRowKeyUp' : 'onRowKeyDown', function(e){
233
- if((t.arg('triggerOnCell') || !e.columnId) && e.keyCode == keys.SPACE){
244
+ if(e.keyCode == keys.SPACE && (!e.columnId ||
245
+ (g._columnsById[e.columnId].rowSelectable) ||
246
+ //When trigger on cell, check if we are navigating on body, reducing the odds of conflictions.
247
+ (t.arg('triggerOnCell') && (!g.focus || g.focus.currentArea() == 'body')))){
234
248
  var cell = g.cell(e.rowId, e.columnId);
235
249
  if(!(cell && cell.isEditing && cell.isEditing())){
236
- t._select(e.rowId, g._isCopyEvent(e));
250
+ t._select(e.rowId, g._isCtrlKey(e));
237
251
  event.stop(e);
238
252
  }
239
253
  }
240
254
  }],
241
- [g, 'setStore', '_syncMarkable']
255
+ [g.model, 'setStore', '_syncUnselectable']
242
256
  );
243
257
  },
244
258
 
@@ -290,13 +304,13 @@ define([
290
304
  }
291
305
  }
292
306
  },
293
-
294
- _syncMarkable: function(){
307
+
308
+ _syncUnselectable: function(){
295
309
  var t = this,
296
- unselectable = this.arg('unselectable');
310
+ unselectable = t.arg('unselectable');
297
311
  for(var id in unselectable){
298
312
  t.model.setMarkable(id, !unselectable[id]);
299
- }
313
+ }
300
314
  }
301
315
  });
302
316
  });