PDA

View Full Version : Simple grid filter in EXT.ND.UIView



bhaidaya
18 Jul 2007, 10:39 AM
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...

RWaters
18 Jul 2007, 11:36 AM
In our working copy I have finished up the search code, and have it going through a modified version of that agent that currently handles single category views just fine. Haven't tried it on others yet.

Also the search code acts similarly to the notes client and allows you to clear the search and go back to the original data store.

bhaidaya
28 Jul 2007, 4:06 PM
Any chance you can kick that agent down to me? I'd love to compare notes...

RWaters
29 Jul 2007, 9:11 AM
I'm just heading back from a conference out in San Fran. Once I get back, Jack and I are going to work up a new revision of the release and we'll include that agent.

bhaidaya
29 Jul 2007, 10:41 AM
Awesome! Thanks.