Skip to content

Commit

Permalink
Allow up/down and left/right to resolve using row/cell methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth G. Franqueiro committed Dec 3, 2012
1 parent 0a0eec9 commit abf2662
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
Expand Up @@ -3,6 +3,13 @@ This document outlines changes since 0.3.0. For older changelogs, see the

# master (0.3.5-dev)

## Significant changes

* The `up` and `down` methods of `List` will now call `grid.row` internally to
resolve whatever argument is passed; the `left` and `right` methods of
`Grid` will call `grid.cell`. (Formerly these methods only accepted a
row or cell object directly.)

## Other changes and fixes

### General/Core
Expand Down
4 changes: 4 additions & 0 deletions Grid.js
Expand Up @@ -143,12 +143,16 @@ function(kernel, declare, listen, has, put, List){
}
return row;
},

left: function(cell, steps){
if(!cell.element){ cell = this.cell(cell); }
return this.cell(this._move(cell, -(steps || 1), "dgrid-cell"));
},
right: function(cell, steps){
if(!cell.element){ cell = this.cell(cell); }
return this.cell(this._move(cell, steps || 1, "dgrid-cell"));
},

renderRow: function(object, options){
var row = this.createRowCells("td", function(td, column){
var data = object;
Expand Down
2 changes: 2 additions & 0 deletions List.js
Expand Up @@ -647,6 +647,7 @@ function(arrayUtil, kernel, declare, listen, has, miscUtil, TouchScroll, hasClas
// A row object representing the appropriate row. If the top of the
// list is reached before the given number of steps, the first row will
// be returned.
if(!row.element){ row = this.row(row); }
return this.row(this._move(row, -(steps || 1), "dgrid-row", visible));
},
down: function(row, steps, visible){
Expand All @@ -664,6 +665,7 @@ function(arrayUtil, kernel, declare, listen, has, miscUtil, TouchScroll, hasClas
// A row object representing the appropriate row. If the bottom of the
// list is reached before the given number of steps, the last row will
// be returned.
if(!row.element){ row = this.row(row); }
return this.row(this._move(row, steps || 1, "dgrid-row", visible));
},

Expand Down

0 comments on commit abf2662

Please sign in to comment.