From 6fd2777a246772aa5eb18bc44e6ea61735339b86 Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Sun, 6 May 2012 19:59:58 -0400 Subject: [PATCH] BUG 8667 "copy, dentro de calendar, muestra un mensaje e.." UPDATE 1 - problemm found before delete work hour row - problem fixed on validation --- .../engine/templates/admin/calendarEdit.js | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/workflow/engine/templates/admin/calendarEdit.js b/workflow/engine/templates/admin/calendarEdit.js index 41af55975..560585695 100644 --- a/workflow/engine/templates/admin/calendarEdit.js +++ b/workflow/engine/templates/admin/calendarEdit.js @@ -346,6 +346,19 @@ Ext.onReady( function() { grid = new Ext.grid.GridPanel( { //grid work days store: store, + sm: new Ext.grid.RowSelectionModel({ + selectSingle: true, + listeners:{ + selectionchange: function(sm) { + if (sm.getCount() == 0) { + Ext.getCmp('btnRemove').setDisabled(true); + } + else { + Ext.getCmp('btnRemove').setDisabled(false); + } + } + } + }), id: "gridCalendar", width: 470, height : 150, @@ -377,17 +390,17 @@ Ext.onReady( function() { ref: '../removeBtn', iconCls: 'icon-user-delete', text: _('ID_REMOVE'), - disabled: false, + id: 'btnRemove', + disabled: true, handler: function(){ - editor.stopEditing(); - var s = grid.getSelectionModel().getSelections(); - // console.log( 's[i]=', s[i].data.name); - for(var i = 0, r; r = s[i]; i++){ - if(s[i].data.name!='- ALL -') - store.remove(r); - else - PMExt.error( _('ID_ERROR'), _('ID_NODELETEOPTIONALL')); - } + editor.stopEditing(); + var record = grid.getSelectionModel().getSelected(); + records = grid.getStore(); + + if (record.data.name == '- ALL -' && records.getCount() === 1) + PMExt.error( _('ID_ERROR'), _('ID_NODELETEOPTIONALL')); + else + store.remove(record); } }],