This is a migrated thread and some comments may be shown as answers.

CustomFilterDescriptor Problem

6 Answers 103 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marcin
Top achievements
Rank 1
Marcin asked on 15 Sep 2011, 10:39 AM
Hello,
I try to implement CustomFilterDescriptor

My grid Has four rows :
1. FirstName
2. LastName
3. Address
4. Age

I want to filter  only 1. 2. and 3. column.
When I Type 'John Doe'
I want to look  for row  that some columns contains John in cell and Doe (Doe can be in another Cell but in the same row!)
is it possible?

I tried to split my Filter value
and add FilterDescriptor for every splited word with every column but Logical operator is set for every filterDescriptor

6 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 15 Sep 2011, 11:47 AM
Hi Marcin,

Create a CompositeFilterDescriptor with LogicalOperator OR and then add the three FilterDescriptors to it.

All the best,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Marcin
Top achievements
Rank 1
answered on 15 Sep 2011, 12:18 PM
It will give wrong result for row  Robert Doe ( row will be returned and shouldnt be )
0
Rossen Hristov
Telerik team
answered on 15 Sep 2011, 12:47 PM
Hi Marcin,

Unfortunately, I really can't understand the requirement.

Can you please try to describe it in as much detail as possible and provide several structured examples that demonstrate what are you trying to achieve.

Thank you.

Best wishes,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Marcin
Top achievements
Rank 1
answered on 15 Sep 2011, 12:54 PM
Hi,
for example we have rows:

FirstName       LastName            Address
John                  Doe                    address1
Adam                Smith                    Doe Street
John                   Fish                     address 3


and phrase is 'John Doe'
I expect to application will show only first row    (becouse this row includes all words from phrase)

second row contains only 'Doe' so it is no good
third contains only John so it is no good
0
Rossen Hristov
Telerik team
answered on 15 Sep 2011, 12:59 PM
Hi Marcin,

You can split your phrase in two. Then add two FilterDescriptors to the CompositeFilterDescriptor. Make the logical operator of the CompositeFilterDescriptor to be AND. You will have FirstName IsEqualTo John AND LastName IsEqualTo Doe.

Of course, you will have to invent some kind of artificial intelligence that can handle any user input.

All the best,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Marcin
Top achievements
Rank 1
answered on 15 Sep 2011, 02:38 PM
Hi Ross,
It is impossible to make it the way you are describing.
I can split it to two words John and Doe

then I must make 6 FilteDescriptors (JOhn and Doe for every column becouse those words can apear in every one of them )

if i use AND then, no row from example will show.

From Logical point i must build something like this:
(firstName.Contains("JOhn") AND (LastName.Contains("Doe") OR Address.Contains("Doe") ) ) OR
(LastName.Contains("JOhn") AND (FirstName.Contains("John") OR Address.Contains("John")) OR
(Address.Contains("John") ANd (FirstName.contains("Doe") OR LastName.Contains("Doe"))

solution you wrote will not work..

Tags
GridView
Asked by
Marcin
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Marcin
Top achievements
Rank 1
Share this question
or