diff --git a/js/app/views/ExplorerUI.js b/js/app/views/ExplorerUI.js index 04184f0..4d3f2a5 100644 --- a/js/app/views/ExplorerUI.js +++ b/js/app/views/ExplorerUI.js @@ -697,16 +697,9 @@ Ext.define('amdaUI.ExplorerUI', { }, field: { validFlag: true, - validator : function(value) { - if(value === amdaModel.AmdaNode.NEW_DIR_NAME) { - this.validFlag = 'Field is not modified' - } - return this.validFlag; - }, listeners: { change : function( field, newValue, oldValue, eOpts ) { - console.log('changing...'); var explModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id); var explUI = explModule.getUiContent(); var activeTreePanel = explUI.getActiveTab(); @@ -714,23 +707,24 @@ Ext.define('amdaUI.ExplorerUI', { var editedNode = activeTreePanel.getSelectionModel().selected.items[0]; if (editedNode) { editedNode.isValidName(newValue, function (res) { - field.validFlag = true; - if (!res) { - field.validFlag = 'Error during object validation'; + var validFlag = true; + if(newValue === amdaModel.AmdaNode.NEW_DIR_NAME) { + validFlag = 'Field is not modified' + } else if (!res) { + validFlag = 'Error during object validation'; } else if (!res.valid) { if (res.error) { - field.validFlag = res.error; + validFlag = res.error; } else { - field.validFlag = 'Invalid object name'; + validFlag = 'Invalid object name'; } } - if (field.validFlag === true) { - console.log('change - valid'); + if (validFlag === true) { field.lastValid = newValue; } else { - console.log('change - not valid:', field.validFlag); - field.markInvalid(field.validFlag); + field.markInvalid(validFlag); } + field.validFlag = validFlag; }); } } @@ -742,19 +736,17 @@ Ext.define('amdaUI.ExplorerUI', { plugins: [ new MyTreeEditor({ pluginId: 'treeEditor', listeners: { - 'validateedit': function (editor, e) { - var field = e.column.field - console.log('validateedit - field=', field); - if(field.validFlag !== true) { - if(field.lastValid) { - e.record.data[e.field] = field.lastValid; + 'edit': function (editor, e) { + if(e.column.field.validFlag !== true) { + if(e.column.field.lastValid) { + e.record.data[e.field] = e.column.field.lastValid; } else { e.record.remove(true); } } }, 'beforeedit': function (editor, e) { - // e.column.field.fireEvent('change', e.value, e.value); + e.column.field.fireEvent('change', e.column.field, e.value, ''); } }, scope: this -- libgit2 0.21.2