commit aad7706081f84db496dab6afae84273ef455fc31
parent e316fce16b1d095f5190e4e80f460c22110ca789
Author: Felicitus <felicitus@felicitus.org>
Date: Sat, 26 Sep 2015 20:10:14 +0200
Finally implemented the dirty asterisk for each editor.
Diffstat:
1 file changed, 11 insertions(+), 21 deletions(-)
diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Editor/Editor.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Editor/Editor.js
@@ -21,17 +21,11 @@ Ext.define('PartKeepr.Editor', {
// If true, always syncs the record via it's own proxy.
syncDirect: false,
- onFieldChange: function ()
- {
- return;
-
- // @todo Finish implementing the dirty flag later
- /*if (this.change == false) {
- this.setTitle(this.record.get("name") + "*");
- }
-
- this.change = true;*/
+ listeners: {
+ dirtychange: "onDirtyChange",
+ scope: "this"
},
+
initComponent: function ()
{
if (this.enableButtons) {
@@ -61,19 +55,15 @@ Ext.define('PartKeepr.Editor', {
});
}
-
- this.on("dirtychange", function (form, dirty)
- {
- // @todo Check dirty flag
- // Waiting for reply on http://www.sencha.com/forum/showthread.php?135142-Ext.form.Basic.loadRecord-causes-form-to-be-dirty&p=607588#post607588
- });
-
- this.defaults.listeners = {
- "change": Ext.bind(this.onFieldChange, this)
- };
-
this.callParent();
},
+ onDirtyChange: function (form, dirty) {
+ if (dirty) {
+ this.setTitle(this.record.get(this.titleProperty) + "*");
+ } else {
+ this.setTitle(this.record.get(this.titleProperty));
+ }
+ },
onCancelEdit: function ()
{
this.fireEvent("editorClose", this);