diff options
author | Michael Leibman <michael.leibman@gmail.com> | 2011-12-14 11:35:23 -0800 |
---|---|---|
committer | Michael Leibman <michael.leibman@gmail.com> | 2011-12-14 11:35:23 -0800 |
commit | 0b5dff4ea697b1a68fcb718459c4100c0e9a6e72 (patch) | |
tree | 962c0d693bc41b42a011776fd455d59ce9d3559f /slick.grid.js | |
parent | 8f83ad30271720209800a699b316c1edd2a73e97 (diff) | |
parent | 8fa4178cb807978436e9db06f2809b00ba2296f3 (diff) | |
download | SlickGrid-0b5dff4ea697b1a68fcb718459c4100c0e9a6e72.zip SlickGrid-0b5dff4ea697b1a68fcb718459c4100c0e9a6e72.tar.gz SlickGrid-0b5dff4ea697b1a68fcb718459c4100c0e9a6e72.tar.bz2 |
Merge pull request #251 from yipdw/field-access-interface
Convert some stray [] accesses to the field accessor interface.
Diffstat (limited to 'slick.grid.js')
-rw-r--r-- | slick.grid.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/slick.grid.js b/slick.grid.js index c261c3b..9e3cdc8 100644 --- a/slick.grid.js +++ b/slick.grid.js @@ -1188,7 +1188,7 @@ if (typeof Slick === "undefined") { currentEditor.loadValue(d); } else { - cellNode.innerHTML = d ? getFormatter(row, m)(row, cell, d[m.field], m, d) : ""; + cellNode.innerHTML = d ? getFormatter(row, m)(row, cell, getDataItemValueForColumn(d, m), m, d) : ""; invalidatePostProcessingResults(row); } } @@ -1197,12 +1197,12 @@ if (typeof Slick === "undefined") { if (!rowsCache[row]) { return; } $(rowsCache[row]).children().each(function(i) { - var m = columns[i]; + var m = columns[i], d = getDataItem(row); if (row === activeRow && i === activeCell && currentEditor) { currentEditor.loadValue(getDataItem(activeRow)); } - else if (getDataItem(row)) { - this.innerHTML = getFormatter(row, m)(row, i, getDataItem(row)[m.field], m, getDataItem(row)); + else if (d) { + this.innerHTML = getFormatter(row, m)(row, i, getDataItemValueForColumn(d, m), m, getDataItem(row)); } else { this.innerHTML = ""; @@ -1872,11 +1872,13 @@ if (typeof Slick === "undefined") { currentEditor = null; if (activeCellNode) { + var d = getDataItem(activeRow); + $(activeCellNode).removeClass("editable invalid"); - if (getDataItem(activeRow)) { + if (d) { var column = columns[activeCell]; - activeCellNode.innerHTML = getFormatter(activeRow, column)(activeRow, activeCell, getDataItem(activeRow)[column.field], column, getDataItem(activeRow)); + activeCellNode.innerHTML = getFormatter(activeRow, column)(activeRow, activeCell, getDataItemValueForColumn(d, column), column, getDataItem(activeRow)); invalidatePostProcessingResults(activeRow); } } @@ -2608,4 +2610,4 @@ if (typeof Slick === "undefined") { init(); } -}(jQuery));
\ No newline at end of file +}(jQuery)); |