partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 1580989dc16f54d9f4a0edd751326378e18ffe04
parent 8ae196333b481d8487ce288a919fc0668e07b03d
Author: Timo A. Hummel <timo@netraver.de>
Date:   Sun, 12 Jun 2011 11:51:43 +0200

Added bugfix for bindStore() bug: http://www.sencha.com/forum/showthread.php?136753-ExtJS-4.0.2-Binding-a-store-to-a-unrendered-view-fails&p=613204#post613204

Diffstat:
Mfrontend/js/bugfixes.js | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+), 0 deletions(-)

diff --git a/frontend/js/bugfixes.js b/frontend/js/bugfixes.js @@ -41,6 +41,60 @@ Ext.override(Ext.data.Connection, { }); +Ext.view.AbstractView.override({ + /** + * Changes the data store bound to this view and refreshes it. + * @param {Store} store The store to bind to this view + */ + bindStore : function(store, initial) { + var me = this; + + if (!initial && me.store) { + if (store !== me.store && me.store.autoDestroy) { + me.store.destroy(); + } + else { + me.mun(me.store, { + scope: me, + datachanged: me.onDataChanged, + add: me.onAdd, + remove: me.onRemove, + update: me.onUpdate, + clear: me.refresh + }); + } + if (!store) { + if (me.loadMask && me.loadMask.bindStore) { + me.loadMask.bindStore(null); + } + me.store = null; + } + } + if (store) { + store = Ext.data.StoreManager.lookup(store); + me.mon(store, { + scope: me, + datachanged: me.onDataChanged, + add: me.onAdd, + remove: me.onRemove, + update: me.onUpdate, + clear: me.refresh + }); + if (me.loadMask && me.loadMask.bindStore) { + me.loadMask.bindStore(store); + } + } + + me.store = store; + // Bind the store to our selection model + me.getSelectionModel().bind(store); + + if (store && (!initial || store.getCount())) { + me.refresh(true); + } + } +}); + Ext.form.field.ComboBox.override({ beforeBlur: function() { var me = this;