-
17 Dec 2009 7:46 AM #91
-
17 Dec 2009 7:55 AM #92
I've been busy with another priority project, so haven't looked into any of the recent requests (sorry!) or debugged any of the issues raised, but at first glance, I don't see why not.
I can't say exactly when at this stage, but if you add that to an overrides file, I'll announce what's been included in the next build allowing you to remove any overrides that were included/fixed.
Thanks,
Dan
-
17 Dec 2009 7:58 AM #93
I did a search on google but couldn't find out what an override file is.
-
17 Dec 2009 8:04 AM #94
Rather than patching source files, simply create a file called 'ext-overrides.js' and create overrides for any issues/bugs/requests - document each override and then when you get a new build of Ext or a component, check your overrides file and remove anything that's no longer needed.
Eg:
It's a neater way of incorporating feature requests, bug fixes etc until the next release.PHP Code:Ext.override(Ext.ux.form.SuperBoxSelect, {
//override of doQuery for blah blah blh reason...
doQuery : ...
});
Update:
PS. Testing q in that way isn't ideal as a record with a value of 0 would fall through. Additionally a bit of background as to what your value is and what problem you experienced is usually more helpful than just a patch as there may be scenarios that you haven't considered, and my source file is usually not in synch with what you are using.
-
17 Dec 2009 8:27 AM #95
Writes can search for multiple keywords separated by spaces. Have time to also change the regular expression
Code:doQuery : function(q, forceAll,valuesQuery){ q = Ext.isEmpty(q) ? '' : q; var qe = { query: q, forceAll: forceAll, combo: this, cancel:false }; if(this.fireEvent('beforequery', qe)===false || qe.cancel){ return false; } q = qe.query; forceAll = qe.forceAll; if(forceAll === true || (q.length >= this.minChars)){ if(this.lastQuery !== q){ this.lastQuery = q; if(this.mode == 'local'){ this.selectedIndex = -1; if(forceAll){ this.store.clearFilter(); }else{ //this.store.filter(this.displayField, q); this.store.filterBy(function(r){ var q_data = q.trim().split(' '); if(Ext.isArray(q_data) && q_data.length > 1) { for(var x in r.data){ var flag = true; q_data.each(function(q){ if(r.data[x].indexOf(q) == -1) { flag = false; } }); return flag; } } else { for(var x in r.data){ if(r.data[x].indexOf(q) != -1) { return true; } } } }); } this.onLoad(); }else{ this.store.baseParams[this.queryParam] = q; this.store.baseParams[this.queryValuesInidicator] = valuesQuery; this.store.load({ params: this.getParams(q) }); this.expand(); } }else{ this.selectedIndex = -1; this.onLoad(); } } }
-
17 Dec 2009 8:34 AM #96
Sorry, but I didn't follow you - what do you mean by 'writes' and which regular expression are you referring to and what changes?
I can't blindly incorporate code without seeing test cases and/or understanding use cases for new features.
I don't mean to sound rude, but a one liner and a block of code isn't very explanatory.
-
17 Dec 2009 8:47 AM #97
Thanks for the ext-overrides.js hint!
@valuesquery: I had the problem that an edit form loads its values and each superboxselect triggers a values query although it has no values which slowed down the loading of the form.
Is there a case there a valuesquery without a value makes sense? I can't think of one.
-
17 Dec 2009 5:33 PM #98
-
18 Dec 2009 2:05 AM #99
@lanhun
Thanks for your code. Search works for me perfectly now.
-
18 Dec 2009 9:31 AM #100
Support for multiple keyword search and Highlight multiple keyword.
Thank you for radtad Code.I revised it. [http://www.extjs.com/forum/showthrea...93#post340193]
Separated by a space.
search eg: 'lanhun card'
Code:Ext.override(Ext.ux.form.SuperBoxSelect, { caseSensitive: false, createValueMatcher: function(value) { return new RegExp('('+value.replace(/\s+/g,'|')+')', this.caseSensitive ? 'g' : 'gi'); }, prepareData : function(data) { var result = Ext.apply({}, data); if (Ext.isEmpty(this.getRawValue())) return result; result[this.displayField] = data[this.displayField].replace(this.createValueMatcher(this.getRawValue()), '<span class="ext-combo-match">$1</span>'); return result; }, initList : function() { Ext.ux.form.SuperBoxSelect.superclass.initList.apply(this, arguments); this.view.prepareData = this.prepareData.createDelegate(this); }, doQuery : function(q, forceAll,valuesQuery){ q = Ext.isEmpty(q) ? '' : q; var qe = { query: q, forceAll: forceAll, combo: this, cancel:false }; if(this.fireEvent('beforequery', qe)===false || qe.cancel){ return false; } q = qe.query; forceAll = qe.forceAll; if(forceAll === true || (q.length >= this.minChars)){ if(this.lastQuery !== q){ this.lastQuery = q; if(this.mode == 'local'){ this.selectedIndex = -1; if(forceAll){ this.store.clearFilter(); }else{ //this.store.filter(this.displayField, q); this.multiSelectMode = true; this.store.filterBy(function(r){ var q_data = q.trim().split(' '); if(Ext.isArray(q_data) && q_data.length > 1) { for(var x in r.data){ var flag = true; q_data.each(function(q){ if(r.data[x].indexOf(q) == -1) { flag = false; } }); return flag; } } else { for(var x in r.data){ if(r.data[x].indexOf(q) != -1) { return true; } } } }); } this.onLoad(); }else{ this.store.baseParams[this.queryParam] = q; this.store.baseParams[this.queryValuesInidicator] = valuesQuery; this.store.load({ params: this.getParams(q) }); this.expand(); } }else{ this.selectedIndex = -1; this.onLoad(); } } } });



Reply With Quote