Skip to content

Commit

Permalink
Merge branch 'master' into dev-0.4
Browse files Browse the repository at this point in the history
Conflicts:
	CHANGES.md
	List.js
	Selection.js
	tree.js
  • Loading branch information
kfranqueiro committed Jan 7, 2014
2 parents f10f60b + 9d791fe commit ebd09b6
Show file tree
Hide file tree
Showing 42 changed files with 1,401 additions and 303 deletions.
101 changes: 93 additions & 8 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,92 @@ The following is a rough list of changes, to be outlined more presentably later.
* Renamed the `observers` instance property to `_observers`
* Desupported `selector`'s `disabled` property (use `Selection#allowSelect`)

# master (0.3.10-dev)
# master (0.3.12-dev)

## Significant changes

### General/Core

* Fixed a regression in `Grid` since 0.3.7 where formatters were run in the
global context by default instead of in the context of the column definition.
(#748, thanks mbretter)

### Mixins

* `Selection` and `CellSelection` now fire `dgrid-select` and `dgrid-deselect`
events on the same turn that `select` is called. The events still include
`rows` or `cells` containing all rows or cells selected at once; only the
timing of the events firing has changed.
* Fixed an issue in `Selection` code flow which caused devices supporting
MSPointer to behave incorrectly with recent versions of Dojo.

## Other changes and fixes

### Mixins

* The `Keyboard` mixin now properly adds/removes header navigation when
`set("showHeader", ...)` is called. (#734)

### Column Plugins

* Added logic to `editor` to preserve editor focus when a row is updated
(particularly useful with always-on editors with autoSave enabled). (#579)

# 0.3.11

## Significant changes

### General/Core

* Fixed a regression related to `OnDemandList` in conjunction with the `tree`
plugin, where queries would not fire due to confusion between different levels.
(#717)
* Fixed a regression related to `List` and `OnDemandList` in conjunction with
`tree` by adding a `cleanEmptyObservers` flag, which `tree` will set to false.
(#713)
* Added a `highlightDuration` property to `List` to allow customizing the length
of time that rows remain highlighted when modified. (#736, thanks Zarillion)

### Mixins

* Fixed a follow-up issue in `Selection` related to the fix for #226, where
deselect events were not firing for removed rows. (#684)

### Column Plugins

* The `tree` column plugin will now include an `originalQuery` property in the
`options` object passed to `getChildren`, allowing store implementations to
re-apply query filters to queries for child items. (#145, #732)

### Extensions

* The `Pagination` extension now has proper setters for `rowsPerPage` and
`pageSizeOptions`. If `rowsPerPage` is set to a value that is not present in
`pageSizeOptions`, an option will be added for the new value. The drop-down's
options will always appear in ascending order. (#631)

## Other changes and fixes

### General/Core

* Fixed an issue in `OnDemandList#_calcRowHeight` to properly calculate height
of the first row. (#552)
* Fixed a compatibility issue in `OnDemandList` and `dojo/store/DataStore` due
to a conflicting property in `queryOptions`. (#440)

### Mixins

* Fixed an issue in `Selection` where its select-all keybinding would prevent
select-all functionality within text editors. (#711)
* Fixed an issue in `Selection` where the selection could fall out of sync for
an item with a falsy id. (#715)

### Extensions

* The `Pagination` extension will now render its footer controls properly in RTL
locales (provided `dgrid_rtl.css` is loaded). (#707)

# 0.3.10

## Significant changes

Expand All @@ -31,13 +116,6 @@ The following is a rough list of changes, to be outlined more presentably later.
issue involving iOS Safari's JavaScript optimization, which was causing
errors in dgrid.

### Extensions

* Improved accessibility of the `ColumnHider` extension, adding a tab stop for
the menu trigger, focusing the first checkbox within the menu when it opens,
allowing it to be dismissed by pressing escape (at which time focus returns
to the trigger), and adding ARIA role and label to the popup menu itself.

## Other changes and fixes

### Mixins
Expand All @@ -48,6 +126,13 @@ The following is a rough list of changes, to be outlined more presentably later.
* The `editor` column plugin will now return focus to the parent cell when an
editor is dismissed, if the `Keyboard` mixin is also in use. (#263)

### Extensions

* Improved accessibility of the `ColumnHider` extension, adding a tab stop for
the menu trigger, focusing the first checkbox within the menu when it opens,
allowing it to be dismissed by pressing escape (at which time focus returns
to the trigger), and adding ARIA role and label to the popup menu itself.

# 0.3.9

## Significant changes
Expand Down
16 changes: 9 additions & 7 deletions CellSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ return declare(Selection, {
// ensure we don't select when an individual cell is not identifiable
selectionDelegate: ".dgrid-cell",

select: function(cell, toCell, value){
_selectionTargetType: "cells",

_select: function(cell, toCell, value){
var i, id;
if(value === undefined){
if(typeof value === "undefined"){
// default to true
value = true;
}
Expand All @@ -28,12 +30,12 @@ return declare(Selection, {
if(value && typeof value === "object"){
// value is a hash of true/false values
for(id in value){
this.select(this.cell(cell.id, id), null, value[id]);
this._select(this.cell(cell.id, id), null, value[id]);
}
}else{
// Select/deselect all columns in row
for(id in this.columns){
this.select(this.cell(cell.id, id), null, value);
this._select(this.cell(cell.id, id), null, value);
}
}
return;
Expand All @@ -44,7 +46,7 @@ return declare(Selection, {
previousRow = selection[rowId];
if(!cell.column){
for(i in this.columns){
this.select(this.cell(rowId, i), null, value);
this._select(this.cell(rowId, i), null, value);
}
return;
}
Expand Down Expand Up @@ -78,7 +80,7 @@ return declare(Selection, {
}
}
if(value != previous && element){
this._selectionEventQueue(value, "cells").push(cell);
this._selectionEventQueues[(value ? "" : "de") + "select"].push(cell);
}
if(toCell){
// a range
Expand Down Expand Up @@ -115,7 +117,7 @@ return declare(Selection, {
// and now loop through each column to be selected
for(i = 0; i < columnIds.length; i++){
cell = this.cell(nextNode, columnIds[i]);
this.select(cell, null, value);
this._select(cell, null, value);
}
if(nextNode == toElement){
break;
Expand Down
2 changes: 1 addition & 1 deletion Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ function(declare, listen, has, put, List, miscUtil){
var formatter = this.formatter,
formatterScope = this.grid.formatterScope;
td.innerHTML = typeof formatter === "string" && formatterScope ?
formatterScope[formatter](data, object) : formatter(data, object);
formatterScope[formatter](data, object) : this.formatter(data, object);
}else if(data != null){
td.appendChild(document.createTextNode(data));
}
Expand Down
13 changes: 10 additions & 3 deletions Keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,16 @@ var Keyboard = declare(null, {
initialNode = areaNode;

function initHeader(){
grid._focusedHeaderNode = initialNode =
cellNavigation ? grid.headerNode.getElementsByTagName("th")[0] : grid.headerNode;
if(initialNode){ initialNode.tabIndex = grid.tabIndex; }
if(grid._focusedHeaderNode){
// Remove the tab index for the node that previously had it.
grid._focusedHeaderNode.tabIndex = -1;
}
if(grid.showHeader){
// Set the tab index only if the header is visible.
grid._focusedHeaderNode = initialNode =
cellNavigation ? grid.headerNode.getElementsByTagName("th")[0] : grid.headerNode;
if(initialNode){ initialNode.tabIndex = grid.tabIndex; }
}
}

if(isHeader){
Expand Down
12 changes: 6 additions & 6 deletions List.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,16 @@ function(declare, listen, has, miscUtil, TouchScroll, hasClass, put){
// the call to addCssRule, not at the time of destruction.
cleanAddedRules: true,

// defaultHighlightDelay: Number
// Default delay between applying and removing highlight when
// calling highlightRow.
defaultHighlightDelay: 250,

// useTouchScroll: Boolean
// If touch support is available, this determines whether to
// incorporate logic from the TouchScroll module (at the expense of
// normal desktop/mouse or native mobile scrolling functionality).
useTouchScroll: true,

// highlightDuration: Integer
// The amount of time (in milliseconds) that a row should remain
// highlighted after it has been updated.
highlightDuration: 250,

postscript: function(params, srcNodeRef){
// perform setup and invoke create in postScript to allow descendants to
Expand Down Expand Up @@ -413,7 +413,7 @@ function(declare, listen, has, miscUtil, TouchScroll, hasClass, put){
put(rowElement, ".ui-state-highlight");
setTimeout(function(){
put(rowElement, "!ui-state-highlight");
}, delay || this.defaultHighlightDelay);
}, delay || this.highlightDuration);
},

adjustRowIndices: function(firstRow){
Expand Down
30 changes: 21 additions & 9 deletions OnDemandList.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ return declare([List, _StoreMixin], {
// Establish query options, mixing in our own.
// (The getter returns a delegated object, so simply using mixin is safe.)
options = lang.mixin(this.get("queryOptions"), options,
{start: 0, count: this.minRowsPerPage, query: query});
{ start: 0, count: this.minRowsPerPage },
"level" in query ? { queryLevel: query.level } : null);

// Protect the query within a _trackError call, but return the QueryResults
this._trackError(function(){ return results = query(options); });
Expand All @@ -166,7 +167,9 @@ return declare([List, _StoreMixin], {
noDataNode = self.noDataNode;

put(loadingNode, "!");
self._total = total;
if(!("queryLevel" in options)){
self._total = total;
}
// now we need to adjust the height and total count based on the first result set
if(total === 0){
if(noDataNode){
Expand Down Expand Up @@ -305,8 +308,14 @@ return declare([List, _StoreMixin], {
// plugins that add connected elements to a row, like the tree

var sibling = rowElement.previousSibling;
return sibling && sibling.offsetTop != rowElement.offsetTop ?
rowElement.offsetHeight : 0;
sibling = sibling && !/\bdgrid-preload\b/.test(sibling.className) && sibling;

// If a previous row exists, compare the top of this row with the
// previous one (in case "rows" are actually rendering side-by-side).
// If no previous row exists, this is either the first or only row,
// in which case we count its own height.
return sibling ? rowElement.offsetTop - sibling.offsetTop :
rowElement.offsetHeight;
},

lastScrollTop: 0,
Expand Down Expand Up @@ -498,11 +507,12 @@ return declare([List, _StoreMixin], {
innerNode.innerHTML = grid.loadingMessage;
loadingNode.count = count;
// use the query associated with the preload node to get the next "page"
options.query = preload.query;
if("level" in preload.query){
options.queryLevel = preload.query.level;
}

// Avoid spurious queries (ideally this should be unnecessary...)
if(options.start > grid._total || options.count < 0){
console.log("Skipping query", options, grid._total);
if(!("queryLevel" in options) && (options.start > grid._total || options.count < 0)){
continue;
}

Expand Down Expand Up @@ -543,7 +553,9 @@ return declare([List, _StoreMixin], {
}

Deferred.when(results.total || results.length, function(total){
grid._total = total;
if(!("queryLevel" in options)){
grid._total = total;
}
if(below){
// if it is below, we will use the total from the results to update
// the count of the last preload in case the total changes as later pages are retrieved
Expand Down Expand Up @@ -600,7 +612,7 @@ return declare([List, _StoreMixin], {
}

// Is this row's observer index different than those on either side?
if(thisIndex > -1 && thisIndex !== prevIndex && thisIndex !== nextIndex){
if(this.cleanEmptyObservers && thisIndex > -1 && thisIndex !== prevIndex && thisIndex !== nextIndex){
// This is the last row that references the observer index. Cancel the observer.
var observers = this._observers;
var observer = observers[thisIndex];
Expand Down
Loading

0 comments on commit ebd09b6

Please sign in to comment.