Categories | Question details Back To List | ||||||||
XGrid methods used to filter multiple columns mathcing with same value. I have below requirement When the user enters partial search string into this textbox, and hits enter, an AJAX dropdown is shown with a list of suggested names. When the user selects one of the names from the AJAX dropdown, the grid table should be filtered on two columns, both the column1 and column2. For example, suppose the award table contains the following four awards. Column1: John Doe, Column2: Jane Schmoe Column1: John Doe, Column2: Jennifer Foo Column1: James Bar, Column2: John Doe Column1: James Bar, Column2: Jane Schmoe If the user enters and selects "John Doe" into the AJAX textbox, the table should shown as below: Column1: John Doe, Column2: Jane Schmoe Column1: John Doe, Column2: Jennifer Foo Column1: James Bar, Column2: John Doe If the user enters and selects "Jane Schmoe" into the AJAX textbox, the table should show Column1: John Doe, Column2: Jane Schmoe Column1: James Bar, Column2: Jane Schmoe I tried with the below ,but this seems works for only the last column method call below (mygrid.filterBy(col2,selectedValue,true)). mygrid.filterBy(col1,selectedValue); mygrid.filterBy(col2,selectedValue,true); Please suggest me how to approach this issue... Regards, Narayan Dhumale Answer posted by dhxSupport on May 25, 2009 09:50 Try to use following algorithm: var val="John Doe"; mygrid.filterBy(0,function(value,id){ if (mygrid.cells(id,0).getValue().toLowerCase().indexOf(val)!=-1) return true; if (mygrid.cells(id,1).getValue().toLowerCase().indexOf(val)!=-1) return true; return false; }); Answer posted on May 26, 2009 02:53 Thanks for your reply.
I have tried the option, but no luck.Could you please suggest me any alternate where i can filter on more than one column with a single search keyword at once. Answer posted by dhxSupport on May 26, 2009 03:01 Please check example at the attachment Attachments (1)
Answer posted on May 29, 2009 04:04 Thanks team! This is wroking fine now...! :) |