diff options
author | mleibman <michael.leibman@gmail.com> | 2011-01-05 15:38:25 -0800 |
---|---|---|
committer | mleibman <michael.leibman@gmail.com> | 2011-01-05 15:38:25 -0800 |
commit | ce54ae3663f2e37086e78b98aa9fa67d7ba5136e (patch) | |
tree | 33c8658f76f2417c5c8c8975fd41d7f420de31ab /slick.grid.js | |
parent | 187a0a2d52e53d6df71c2bb96a766341b5e88abc (diff) | |
download | SlickGrid-ce54ae3663f2e37086e78b98aa9fa67d7ba5136e.zip SlickGrid-ce54ae3663f2e37086e78b98aa9fa67d7ba5136e.tar.gz SlickGrid-ce54ae3663f2e37086e78b98aa9fa67d7ba5136e.tar.bz2 |
Work in progress.
Added a CompositeEditor that can combine several editors and host them in specified containers.
Added an example of using the CompositeEditor to do an item edit form.
It is also a launching pad for adding ExtJS-like row level editing support.
Diffstat (limited to 'slick.grid.js')
-rw-r--r-- | slick.grid.js | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/slick.grid.js b/slick.grid.js index 6b7c815..1afeaee 100644 --- a/slick.grid.js +++ b/slick.grid.js @@ -1843,7 +1843,7 @@ if (typeof Slick === "undefined") { getEditorLock().deactivate(editController); } - function makeActiveCellEditable() { + function makeActiveCellEditable(editor) { if (!activeCellNode) { return; } if (!options.editable) { throw "Grid : makeActiveCellEditable : should never get called when options.editable is false"; @@ -1856,7 +1856,10 @@ if (typeof Slick === "undefined") { return; } - if (trigger(self.onBeforeEditCell, {row:activeRow, cell:activeCell,item:getDataItem(activeRow)}) === false) { + var columnDef = columns[activeCell]; + var item = getDataItem(activeRow); + + if (trigger(self.onBeforeEditCell, {row:activeRow, cell:activeCell, item:item, column:columnDef}) === false) { setFocus(); return; } @@ -1864,12 +1867,12 @@ if (typeof Slick === "undefined") { getEditorLock().activate(editController); $(activeCellNode).addClass("editable"); - activeCellNode.innerHTML = ""; - - var columnDef = columns[activeCell]; - var item = getDataItem(activeRow); + // don't clear the cell if a custom editor is passed through + if (!editor) { + activeCellNode.innerHTML = ""; + } - currentEditor = new (getEditor(columnDef))({ + currentEditor = new (editor || getEditor(columnDef))({ grid: self, gridPosition: absBox($container[0]), position: absBox(activeCellNode), @@ -2192,6 +2195,7 @@ if (typeof Slick === "undefined") { $(activeCellNode).stop(true,true).effect("highlight", {color:"red"}, 300); trigger(self.onValidationError, { + editor: currentEditor, cellNode: activeCellNode, validationResults: validationResults, row: activeRow, |