Sha256: d086363f5cd75e5e622a1f4721806dc41785228aa23b7a0d7fa9c92b0735d10d
Contents?: true
Size: 1.7 KB
Versions: 3
Compression:
Stored size: 1.7 KB
Contents
{ initComponent: function() { this.callParent(); this.buildFormFromQuery(this.presetQuery); this.netzkeOnAddCondition(); }, // Will probably need to be performance-optimized in the future, as recreating the fields is expensive buildFormFromQuery: function(query) { this.netzkeOnClearAll(); Ext.each(query, function(f){ f.ownerCt = this; this.insert(this.items.length - 1, Ext.createByAlias('widget.netzkebasepacksearchpanelconditionfield', f)); }, this); this.updateLayout(); }, netzkeOnAddCondition: function() { var condField = Ext.createByAlias('widget.netzkebasepacksearchpanelconditionfield', {ownerCt: this}); condField.on('configured', function() { this.netzkeOnAddCondition(); }, this, {single: true}); this.add(condField); this.updateLayout(); this.fireEvent('fieldsnumberchange'); }, netzkeOnReset: function() { this.items.each(function(f){ if (f.valueField) {f.clearValue();} }); }, netzkeOnClearAll: function() { this.eachConfiguredField(function(f) { this.remove(f); }, this); this.fireEvent('fieldsnumberchange'); }, // Returns each condition field which has attribute selected eachConfiguredField: function(fn, scope) { this.items.each(function(f, i) { if (this.items.last() !== f) { fn.call(scope || f, f); } }, this); }, // When "all" is "true", also includes the fields with empty values getQuery: function(all) { var query = []; this.eachConfiguredField(function(f){ if (f.valueIsSet() || all) { var cond = f.buildValue(); if (all) {cond.type = f.type;} query.push(cond); } }); return query; } }
Version data entries
3 entries across 3 versions & 1 rubygems