diff --git a/static/plugin_dbui/src/appgridroweditortoolbar.js b/static/plugin_dbui/src/appgridroweditortoolbar.js index 83045f79a8bad4bee4a1a77b5f909245d8d6ed81..85a2c867ad457a573b0d957fd9c789be609dc490 100644 --- a/static/plugin_dbui/src/appgridroweditortoolbar.js +++ b/static/plugin_dbui/src/appgridroweditortoolbar.js @@ -1,8 +1,6 @@ /** - * The row editor toolbar plugin - * - * Add a toolbar to the grid with button to manipulate the App.grid.RowEditor. - * The latter is instantiated if not already create. + * Add a toolbar with buttons to manipulate the App.grid.RowEditor. + * Requires the App.grid.GridRowEditor plugin. * * The ptype of this component is pGridRowEditorToolbar. * @@ -26,14 +24,9 @@ App.grid.RowEditorToolbar = Ext.extend(Object, { var toolbar; - // create and initialize the underlying RowEditor - if (!grid.editor) { - grid.editor = new App.grid.RowEditor({ - formModel: grid.model.formModel, - table: grid.model.table - }); - - grid.editor.init(grid); + // protection + if (!grid.rowEditor) { + throw new Error('no grid row editor !!!'); } toolbar = grid.getTopToolbar(); @@ -41,30 +34,30 @@ App.grid.RowEditorToolbar = Ext.extend(Object, { toolbar.add([{ text: 'Add', iconCls: 'silk-add', - handler: grid.editor.onAddRow, - scope: grid.editor + handler: grid.rowEditor.onAddRow, + scope: grid.rowEditor }, ' ', { text: 'Delete', iconCls: 'silk-delete', - handler: grid.editor.onDeleteRow, - scope: grid.editor + handler: grid.rowEditor.onDeleteRow, + scope: grid.rowEditor }, ' ', { text: 'Duplicate', iconCls: 'silk-clone', - handler: grid.editor.onDuplicateRow, - scope: grid.editor + handler: grid.rowEditor.onDuplicateRow, + scope: grid.rowEditor }, ' ', { text: 'Update', iconCls: 'silk-update', - handler: grid.editor.onEditRow, - scope: grid.editor + handler: grid.rowEditor.onEditRow, + scope: grid.rowEditor }, ' ', { text: 'View', iconCls: 'silk-view', - handler: grid.editor.onViewRow, - scope: grid.editor + handler: grid.rowEditor.onViewRow, + scope: grid.rowEditor }, '-']); } }); -Ext.preg('pGridRowEditorToolbar', App.grid.RowEditorToolbar); +Ext.preg('pGridRowEditorToolbar', App.grid.RowEditorToolbar); \ No newline at end of file