Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by shweta on Oct 08, 2008 05:01
open dhtmlx forum
find button which shows data present in dhtmlxgrid

i want to add functionality given in this link on my jsp page link is
http://dhtmlx.com/docs/products/docsExplorer/index.shtml?node=dhtmlxgrid



i do not want to attach header for each column.i just want a single textbox in which i write search criteria which displays results find in that dhtmlxgrid.



Please suggest me!!!!!it's urgent
Answer posted by Support on Oct 08, 2008 06:44
You can use filterBy API instead of in-header filters

<input type="text" id="filter" value="">
<input type="button" value="filter" onclick="mygrid.filterBy(0,document.getElementById('filter').value)" >

Answer posted by shweta on Oct 08, 2008 06:58

which js is to be included for that?i got error object expected

 

Please response

Answer posted by shweta on Oct 08, 2008 09:52
the code you have given is working on specific column..but i dont need to pass column.the search criteria can be in any column or row...
Please suggest me appropriate solution for that.
Answer posted by Support on Oct 08, 2008 10:01
The filterBy can be used for multiple columns, but this command will use AND logic for search queries, not OR. So it not possible to filter rows where searched value exists at least in one of columns
Technically complex workaround can be used, by findRows methods, which not filter grid, but returns an array of cells which match search criteria, which can be used with custom filtering function - it pretty complicated approach. 
Answer posted by shweta on Oct 08, 2008 10:16
how can be filter use for multiple column.Please let me know...



reply!!

Answer posted by Support on Oct 09, 2008 02:16
You can use 
       grid.filteBy([0,1,2].["a","b","c"]);
First parameter an array of column indexes, the second is an array of filtering criteria
Answer posted by shweta on Oct 09, 2008 09:12
hi i'm using
mygrid.filterBy([0,1,2,3,4,5,6,7,8],[document.getElementById('filter').value]);

but it gives error!!!!
Please suggest solution for that
Answer posted by Support on Oct 10, 2008 05:35
The count of values in first and second array must be equal 
var val = document.getElementById('filter').value;
mygrid.filterBy([0,1,2,3,4,5,6,7,8],[val,val,val,val,val,val,val,val,val]);
Answer posted by shweta on Oct 12, 2008 21:44

i used

var a=document.getElementById('filter').value;

createGrid.filterBy([0,1,2,3,4,5],[a,a,a,a,a,a]);

 

but it's not working.....it doesn't show search result

 

Please help me!!

Answer posted by Support on Oct 13, 2008 04:18
As it was mentioned earlier 
>>The filterBy can be used for multiple columns, but this command will use AND logic for search queries

createGrid.filterBy([0,1,2,3,4,5],[a,a,a,a,a,a]);

means 
 where column0 LIKE "%a%"AND column1 LIKE "%a%"AND column2 LIKE "%a%"AND column3 LIKE "%a%"AND column4  LIKE "%a%"AND column5 LIKE "%a%"