Problem solved,
use setOperator(OperatorId.CONTAINS);
Greets,
Jan
[CODE]
final DynamicForm filterForm = new DynamicForm();
filterForm.setIsGroup(true);
filterForm.setGroupTitle("Search");
filterForm.setNumCols(6);
filterForm.setDataSource(AnimalXmlDS.getInstance());
filterForm.setAutoFocus(false);
TextItem commonNameItem = new TextItem("commonName");
commonNameItem.setOperator(OperatorId.CONTAINS);
filterForm.setFields(commonNameItem);
filterForm.addItemChangedHandler(new ItemChangedHandler() {
public void onItemChanged(ItemChangedEvent event) {
tileGrid.fetchData(filterForm.getValuesAsCriteria());
}
});
[/CODE]
On Aug 18, 2009, at 9:32 AM, Sanjiv Jivan wrote:
> Jan,
> Please post SmartGWT specific questions on the SmartGWT forum :
> http://forums.smartclient.com/forumdisplay.php?f=14
>
> Thanks,
> Sanjiv
>
> On Mon, Aug 17, 2009 at 7:00 PM, Jan <[email protected]> wrote:
>
> Hi everybody,
>
> I am just new to GWT and experiencing a little bit with SmartGWT,
> implementing and trying to change the Tile Sort & Filtering Example
> from the Showcase
> http://www.smartclient.com/smartgwt/showcase/#featured_tile_filtering
>
> I am trying to implement the above example with a fuzzy search but
> without the extra SearchItems, which causes the FuzzySearch to fail
> and draw back on an EQUALS search.
>
>
> Everything works fine with the example, but here comes my 'error' /
> 'bug' :
> Here is an excerpt from the code from the showcase example:
>
> <code>
>
> final DynamicForm filterForm = new DynamicForm();
> filterForm.setIsGroup(true);
> filterForm.setGroupTitle("Search");
> filterForm.setNumCols(6);
> filterForm.setDataSource(AnimalXmlDS.getInstance());
> filterForm.setAutoFocus(false);
>
> TextItem commonNameItem = new TextItem("commonName");
> SliderItem lifeSpanItem = new SliderItem("lifeSpan");
> lifeSpanItem.setTitle("Max Life Span");
> lifeSpanItem.setMinValue(1);
> lifeSpanItem.setMaxValue(60);
> lifeSpanItem.setDefaultValue(60);
> lifeSpanItem.setHeight(50);
> lifeSpanItem.setOperator(OperatorId.LESS_THAN);
>
> SelectItem statusItem = new SelectItem("status");
> statusItem.setOperator(OperatorId.EQUALS);
> statusItem.setAllowEmptyValue(true);
>
> filterForm.setFields(commonNameItem, lifeSpanItem,
> statusItem);
>
> filterForm.addItemChangedHandler(new ItemChangedHandler() {
> public void onItemChanged(ItemChangedEvent event) {
> tileGrid.fetchData(filterForm.getValuesAsCriteria());
> }
> });
>
> </code>
>
>
> Three search items are created and fit together in the filterForm.
> Using the form and entering just a part of a Common Name, will break
> down the results with each letter I type.
>
> Now comes the bad part:
>
> I do not want the lifeSpanItem and statusItem any more. So I change
>
> <code>
> filterForm.setFields(commonNameItem, lifeSpanItem, statusItem);
> </code>
>
> to
> <code>
> filterForm.setFields(commonNameItem);
> </code>
>
> Now, trying to enter just a part of a Common Name will not break down
> my results with each letter I type, but instead the behaviour is like
> commonNameItem.setOperator(OperatorId.EQUALS)
>
>
> So what I am saying is that the search works fine for searchItems
> greater than just one TextField. My workaround therefore was to create
> a HiddenItem as follows:
> <code>
> HiddenItem tagsItem = new HiddenItem("tags");
> tagsItem.setOperator(OperatorId.EQUALS);
>
> filterForm.setFields(commonNameItem, tagsItem);
> </code>
>
> Now I think that this can't be right. Now am I missing something? Do I
> have to use .setOperator on commonNameItem, if only commonNameItem is
> present? If yes: Which OperatorId should I choose?
>
>
> Thank you very much for your help,
>
> Greets,
>
> Jan
>
>
>
>
>
>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---