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.
- checksums.yaml +8 -8
- data/README.md +3 -3
- data/app/assets/javascripts/gridx/Grid.js +3 -2
- data/app/assets/javascripts/gridx/core/model/cache/_Cache.js +25 -8
- data/app/assets/javascripts/gridx/modules/Bar.js +1 -2
- data/app/assets/javascripts/gridx/modules/Body.js +15 -7
- data/app/assets/javascripts/gridx/modules/CellWidget.js +8 -4
- data/app/assets/javascripts/gridx/modules/ColumnLock.js +12 -12
- data/app/assets/javascripts/gridx/modules/ColumnResizer.js +9 -10
- data/app/assets/javascripts/gridx/modules/Dod.js +1 -0
- data/app/assets/javascripts/gridx/modules/Edit.js +18 -15
- data/app/assets/javascripts/gridx/modules/Filter.js +7 -3
- data/app/assets/javascripts/gridx/modules/Focus.js +45 -36
- data/app/assets/javascripts/gridx/modules/GroupHeader.js +2 -1
- data/app/assets/javascripts/gridx/modules/HLayout.js +1 -0
- data/app/assets/javascripts/gridx/modules/HScroller.js +1 -0
- data/app/assets/javascripts/gridx/modules/Header.js +8 -1
- data/app/assets/javascripts/gridx/modules/HeaderMenu.js +1 -0
- data/app/assets/javascripts/gridx/modules/HeaderRegions.js +2 -1
- data/app/assets/javascripts/gridx/modules/IndirectSelect.js +7 -34
- data/app/assets/javascripts/gridx/modules/IndirectSelectColumn.js +4 -13
- data/app/assets/javascripts/gridx/modules/Menu.js +5 -1
- data/app/assets/javascripts/gridx/modules/NavigableCell.js +3 -1
- data/app/assets/javascripts/gridx/modules/NestedSort.js +4 -1
- data/app/assets/javascripts/gridx/modules/Pagination.js +1 -0
- data/app/assets/javascripts/gridx/modules/Persist.js +1 -0
- data/app/assets/javascripts/gridx/modules/RowHeader.js +11 -10
- data/app/assets/javascripts/gridx/modules/SingleSort.js +1 -0
- data/app/assets/javascripts/gridx/modules/SummaryBar.js +1 -0
- data/app/assets/javascripts/gridx/modules/ToolBar.js +3 -0
- data/app/assets/javascripts/gridx/modules/TouchScroll.js +1 -0
- data/app/assets/javascripts/gridx/modules/TouchVScroller.js +28 -5
- data/app/assets/javascripts/gridx/modules/Traverse.js +1 -0
- data/app/assets/javascripts/gridx/modules/Tree.js +2 -1
- data/app/assets/javascripts/gridx/modules/VLayout.js +1 -0
- data/app/assets/javascripts/gridx/modules/VScroller.js +22 -11
- data/app/assets/javascripts/gridx/modules/View.js +11 -6
- data/app/assets/javascripts/gridx/modules/VirtualVScroller.js +8 -4
- data/app/assets/javascripts/gridx/modules/dnd/Column.js +3 -4
- data/app/assets/javascripts/gridx/modules/dnd/Row.js +3 -4
- data/app/assets/javascripts/gridx/modules/dnd/_Dnd.js +1 -0
- data/app/assets/javascripts/gridx/modules/extendedSelect/Cell.js +4 -3
- data/app/assets/javascripts/gridx/modules/extendedSelect/Column.js +6 -7
- data/app/assets/javascripts/gridx/modules/extendedSelect/Row.js +33 -15
- data/app/assets/javascripts/gridx/modules/filter/FilterBar.js +9 -7
- data/app/assets/javascripts/gridx/modules/filter/FilterDialog.js +1 -1
- data/app/assets/javascripts/gridx/modules/filter/FilterPane.js +1 -1
- data/app/assets/javascripts/gridx/modules/filter/QuickFilter.js +1 -0
- data/app/assets/javascripts/gridx/modules/move/Column.js +2 -1
- data/app/assets/javascripts/gridx/modules/move/Row.js +2 -1
- data/app/assets/javascripts/gridx/modules/pagination/PaginationBar.js +1 -0
- data/app/assets/javascripts/gridx/modules/pagination/PaginationBarDD.js +2 -0
- data/app/assets/javascripts/gridx/modules/select/Cell.js +10 -7
- data/app/assets/javascripts/gridx/modules/select/Column.js +3 -2
- data/app/assets/javascripts/gridx/modules/select/Row.js +27 -13
- data/app/assets/javascripts/gridx/support/QuickFilter.js +7 -2
- data/lib/gridx-rails/version.rb +1 -1
- data/test/dummy/log/test.log +5 -0
- metadata +2 -2
@@ -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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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
|
-
|
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 =
|
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) && (
|
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.
|
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.
|
291
|
+
t._start({row: e.visualIndex}, g._isCtrlKey(e), e.shiftKey);
|
272
292
|
t._end();
|
273
293
|
}
|
274
294
|
}],
|
275
|
-
[g, 'setStore', '
|
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.
|
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.
|
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
|
-
|
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 =
|
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
|
-
|
468
|
+
_syncUnselectable: function(){
|
451
469
|
var t = this,
|
452
|
-
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
|
-
|
340
|
-
this.model.
|
341
|
-
|
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
|
-
|
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
|
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
|
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,
|
@@ -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',
|
168
|
-
|
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.
|
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.
|
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.
|
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, '
|
228
|
+
[g, 'onRowMouseDown', function(e){
|
220
229
|
//Have to check whether we are on the
|
221
|
-
if((
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
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(
|
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.
|
250
|
+
t._select(e.rowId, g._isCtrlKey(e));
|
237
251
|
event.stop(e);
|
238
252
|
}
|
239
253
|
}
|
240
254
|
}],
|
241
|
-
[g, 'setStore', '
|
255
|
+
[g.model, 'setStore', '_syncUnselectable']
|
242
256
|
);
|
243
257
|
},
|
244
258
|
|
@@ -290,13 +304,13 @@ define([
|
|
290
304
|
}
|
291
305
|
}
|
292
306
|
},
|
293
|
-
|
294
|
-
|
307
|
+
|
308
|
+
_syncUnselectable: function(){
|
295
309
|
var t = this,
|
296
|
-
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
|
});
|