commit 953abc9a6c4cb606559f4cf104c319e00ee2cb1a
parent aedb9ca132e417bef57ee1323958bef93f3d3a3a
Author: Felicitus <felicitus@felicitus.org>
Date: Sun, 30 Aug 2015 16:25:16 +0200
Re-added reload button for categories
Diffstat:
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/CategoryComboBox.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/CategoryComboBox.js
@@ -1,4 +1,36 @@
Ext.define("PartKeepr.CategoryComboBox",{
extend:"Ext.ux.TreePicker",
- alias: 'widget.CategoryComboBox'
+ alias: 'widget.CategoryComboBox',
+
+ triggers: {
+ reload: {
+ cls: "x-form-reload-trigger",
+ weight: -1,
+ handler: function ()
+ {
+ this.store.load();
+ },
+ scope: 'this'
+ }
+ },
+
+ _oldValue: null,
+
+ initComponent: function () {
+ this.listenersStore = this.store.on({
+ scope: this,
+ // Workaround to remember the value when loading
+ beforeload: function () {
+ this._oldValue = this.getValue();
+ },
+ // Set the old value when load is complete
+ load: function () {
+ if (this._oldValue !== null) {
+ this.setValue(this._oldValue);
+ }
+ }
+ });
+
+ this.callParent();
+ }
});
\ No newline at end of file