Hi all,
I am trying to create a component that displays a list of people and then
lets the user filter this list based on a few criteria (first name, last
name, etc.). I haven't been using ajax until very recently, so I'm sorry if
this is an easy newbie question. The setup I have is I am observing
multiple fields (first name input, last name input) with the same
AjaxObserveField component and the AjaxObserveField updates an
AjaxUpdateContainer (a repetition with the qualified result list). When I
type something in just the last name input, everything works as expected.
Same with just the first name input. But if I've typed something in the
last name input and then I type something in the first name input, the
variable storing the last name in the component gets set to null (via a
setter method) and, as a consequence, the results are only qualified using
the first name input. I have no idea why the value is getting set to null
and I'm hoping someone can shed some light on what's going on and how to fix
this issue. I'm using Webobjects 5.4.3 and a version of Project WOnder that
is about a month old. Here's the relevant stuff from the component:
<webobject name = "FormValuesObserveField">
<div class="formInput">First Name: <webobject name = "FirstNameFilterText"
/></div>
<div class="formInput">Last Name: <webobject name = "LastNameFilterText"
/></div>
</webobject>
<webobject name = "ResultsContainer">
... (list of results)
</webobject>
FormValuesObserveField : AjaxObserveField {
observeFieldFrequency = "0.5";
observeDelay = "0.5";
updateContainerID = "results";
}
FirstNameFilterText : WOTextField {
value = firstNameFilter;
id = "firstNameFilter";
}
LastNameFilterText : WOTextField {
value = lastNameFilter;
id = "lastNameFilter";
}
ResultsContainer : AjaxUpdateContainer {
id = "results";
}
In the java file I have:
private String _firstNameFilter;
private String _lastNameFilter;
private NSArray _filteredArray;
public String firstNameFilter() {
return _firstNameFilter;
}
public void setFirstNameFilter(String value) {
_firstNameFilter = value;
_filteredArray = null;
}
public String lastNameFilter() {
return _lastNameFilter;
}
public void setLastNameFilter(String value) {
_lastNameFilter = value;
_filteredArray = null;
}
public NSArray allClientsAfterFilter() {
if (_filteredArray == null) {
EOQualifier lastNameQual = null;
if (_lastNameFilter != null) {
lastNameQual = ERXQ.likeInsensitive("personInfo.lastName",
_lastNameFilter + "*");
} else {
lastNameQual = ERXQ.likeInsensitive("personInfo.lastName", "*");
}
EOQualifier firstNameQual = null;
if (_firstNameFilter != null) {
firstNameQual = ERXQ.likeInsensitive("personInfo.firstName",
_firstNameFilter + "*");
} else {
firstNameQual = ERXQ.likeInsensitive("personInfo.firstName", "*");
}
EOQualifier qual = ERXQ.and(lastNameQual, firstNameQual);
_filteredArray =
EOSortOrdering.sortedArrayUsingKeyOrderArray(EOQualifier.filteredArrayWithQualifier(allClients(),
qual), null);
}
return _filteredArray;
}
Thanks for any help on this.
Regards,
Joe Kramer
CyberApps, Inc.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]