rickilama54 / smartgwt

Automatically exported from code.google.com/p/smartgwt
0 stars 0 forks source link

Retrieve search criteria from FilterBuilder #363

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

I need to retrieve the search criteria entered by the user from a
filterBuilder. Specifically, i want to get the fields and values that make
up the search.
At the moment i want to do it locally, without RPCs.
[CODE]System.out.println(filterBuilder.getCriteria().getValues());[/CODE]
returns:
[CODE]{_constructor=AdvancedCriteria, operator=and, criteria=[object
Object]}[/CODE]
I have tried different ways to retrieve the search parameters from the
criteria field in the map, but i always get the string: [object Object]

I have also tried to do it in the filterBuilder sample of the showcase,
with the WorldsXmlDS DataSource, with the same result.

Any advice? 
Thanks in advance

Original issue reported on code.google.com by currahee...@gmail.com on 16 Nov 2009 at 5:57

GoogleCodeExporter commented 8 years ago
srry, i posted it as a defect by mistake..

Original comment by currahee...@gmail.com on 27 Nov 2009 at 4:40

GoogleCodeExporter commented 8 years ago

Original comment by sanjiv.j...@gmail.com on 28 Nov 2009 at 2:43

GoogleCodeExporter commented 8 years ago
I am also looking for same kind of solution.

I want to save the parameters and criteria entered by the end user.

Any help ?

Criteria cr = filterBuilder.getCriteria();
                Map map = cr.getValues();
                Set keys = map.keySet();
                Iterator it = keys.iterator();

                while( it.hasNext()){
                    String key = it.next().toString();
                    System.out.println("=> "+map.get(key));
                }
Out put
=> AdvancedCriteria
=> and
=> [object Object]

Now how can I retrieve values from objects and later i can set it back to 
filter 
builder when user logged in again????

Original comment by amin.mi...@gmail.com on 15 Apr 2010 at 7:34

GoogleCodeExporter commented 8 years ago
Issue 445 has been merged into this issue.

Original comment by sanjiv.j...@gmail.com on 15 Apr 2010 at 7:42

GoogleCodeExporter commented 8 years ago
Is there any one who can help me for above issue?

Original comment by amin.mi...@gmail.com on 16 Apr 2010 at 2:03

GoogleCodeExporter commented 8 years ago
Sanjiv Can you provide any solution on this topic?

Original comment by amin.mi...@gmail.com on 16 Apr 2010 at 1:18

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Advanced Criteria is a nested structure and cannot be converted to a simple 
field-value Map because there may be more than one Criterion on the same field.

APIs on AdvancedCriteria such as getCriteria() allow you to recursively 
traverse the structure to discover whatever you want.

You can easily serialize and restore an AdvancedCriteria using JSONEncoder.

Original comment by smartgwt...@gmail.com on 18 Apr 2012 at 12:43