From 60aedf7963d52c01ac3d09ea22e521abd10d4594 Mon Sep 17 00:00:00 2001 From: Gabriel Sidler Date: Thu, 3 Apr 2014 17:45:57 +0200 Subject: [PATCH] Cleanup dirty record when editor window is closed with close tool in panel header. --- src/calendar/form/EventWindow.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/calendar/form/EventWindow.js b/src/calendar/form/EventWindow.js index f289ab73..532e16c5 100644 --- a/src/calendar/form/EventWindow.js +++ b/src/calendar/form/EventWindow.js @@ -66,6 +66,7 @@ Ext.define('Extensible.calendar.form.EventWindow', { // General configs closeAction: 'hide', + closable: false, modal: false, resizable: false, constrain: true, @@ -77,7 +78,18 @@ Ext.define('Extensible.calendar.form.EventWindow', { formPanelConfig: { border: false }, - + + /** + * Add close tool to panel header. When closing the editor it is important to cleanup the record if dirty. + * Handle it the same way as the cancel button. + */ + tools: [{ + type:'close', + handler: function(evt, el, header){ + header.ownerCt.onCancel(); + } + }], + /** * @cfg {Boolean} allowDefaultAdd * @since 1.6.0