bhaidaya
07-18-2007, 02:39 PM
Here is a simple fix for the included search field on UIView toolbar
include this in your EXTND-Overrides.js file or simply edit the source in EXTND-all-debug.js
Ext.nd.UIView.prototype.handleViewSearch = function() {
var ds = this.grid.dataSource;
var searchBox = this.searchField;
var cm = this.cm;
var value = searchBox.getValue();
if (value.length==0) {
ds.clearFilter();
}else{
value = value.replace(/^\s+|\s+$/g, "");
if (value=="") return;
var aux1=[];
for (var j=0; j<cm.config.length; j++){
aux1[aux1.length] = cm.config[j].dataIndex;
}
ds.filterBy(function(r) {
var aux2 = false;
for (var j=0; j<aux1.length; j++){
if ( r.data[aux1[j]].data[0].toLowerCase().indexOf(value.toLowerCase()) < 0 ){
aux2 = false;
}else{
aux2 = true;
break;
}
}
if (aux2 == false){
return false;
}
return true;
});
}
}
of course in order to get it to show up youd need to add your 'showSearch: true' config option
var resources = new Ext.nd.UIView({
viewName : 'contentmanagementfileresources',
container : 'view-resources',
showActionbar: true,
showSearch: true
});
i'd like to incorporate the [x] button showing up after any entry is made in the search field and also include a datastore to save historic searches.
I also got a fulltext search working using this agent code (http://www.vincedimascio.com/ls/SearchViewEntries.html)which mimics ?ReadviewEntries' but then scrapped it after realizing it was useless to me in categorized views...
include this in your EXTND-Overrides.js file or simply edit the source in EXTND-all-debug.js
Ext.nd.UIView.prototype.handleViewSearch = function() {
var ds = this.grid.dataSource;
var searchBox = this.searchField;
var cm = this.cm;
var value = searchBox.getValue();
if (value.length==0) {
ds.clearFilter();
}else{
value = value.replace(/^\s+|\s+$/g, "");
if (value=="") return;
var aux1=[];
for (var j=0; j<cm.config.length; j++){
aux1[aux1.length] = cm.config[j].dataIndex;
}
ds.filterBy(function(r) {
var aux2 = false;
for (var j=0; j<aux1.length; j++){
if ( r.data[aux1[j]].data[0].toLowerCase().indexOf(value.toLowerCase()) < 0 ){
aux2 = false;
}else{
aux2 = true;
break;
}
}
if (aux2 == false){
return false;
}
return true;
});
}
}
of course in order to get it to show up youd need to add your 'showSearch: true' config option
var resources = new Ext.nd.UIView({
viewName : 'contentmanagementfileresources',
container : 'view-resources',
showActionbar: true,
showSearch: true
});
i'd like to incorporate the [x] button showing up after any entry is made in the search field and also include a datastore to save historic searches.
I also got a fulltext search working using this agent code (http://www.vincedimascio.com/ls/SearchViewEntries.html)which mimics ?ReadviewEntries' but then scrapped it after realizing it was useless to me in categorized views...