Sha256: 8287830131c2859b2ac86e7a55e9c3da3c24a69d7690fcb70e8ef672a7c56563
Contents?: true
Size: 1.63 KB
Versions: 5
Compression:
Stored size: 1.63 KB
Contents
{ initComponent: function() { this.callParent(); this.buildFormFromQuery(this.presetQuery); this.onAddCondition(); }, // Will probably need to be performance-optimized in the future, as recreating the fields is expensive buildFormFromQuery: function(query) { this.onClearAll(); Ext.each(query, function(f){ this.insert(this.items.length - 1, Ext.apply(f, {xtype: 'netzkebasepacksearchpanelconditionfield'})); }, this); this.doLayout(); }, onAddCondition: function() { var condField = Ext.createByAlias('widget.netzkebasepacksearchpanelconditionfield', {ownerCt: this}); condField.on('configured', function() { this.onAddCondition(); }, this, {single: true}); this.add(condField); this.doLayout(); this.fireEvent('fieldsnumberchange'); }, onReset: function() { this.items.each(function(f){ if (f.valueField) {f.clearValue();} }); }, onClearAll: 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.attrType = f.attrType;} query.push(cond); } }); return query; } }
Version data entries
5 entries across 5 versions & 1 rubygems