Re: Ajax List Filtering
Re: Ajax List Filtering
- Subject: Re: Ajax List Filtering
- From: Chuck Hill <email@hidden>
- Date: Sat, 29 May 2010 19:43:11 -0700
On May 29, 2010, at 6:09 PM, Joe Kramer wrote:
Hi all,
Spoke to soon... This all works if I am doing a full Wonder app,
but unfortunately I am not extending ERXApplication, ERXSession, and
ERXComponent in my application. Is there a way to get this to work
without going fully Wonder?
That should work. Are you doing a full or partial Ajax submit?
Chuck
On Sat, May 29, 2010 at 5:44 PM, Joe Kramer <email@hidden>
wrote:
Hi Ricardo,
I started a new project and just copied everything below and it
works fine. So there is something screwy in my actual project. I
will have to figure out what is causing the issue.
Thanks for all the help!
Joe Kramer
CyberApps, Inc.
On Sat, May 29, 2010 at 5:03 PM, Ricardo J. Parada <email@hidden>
wrote:
It seems to work for me. I just took you code and typed it into the
component editor. Pasting it was giving me some errors, so I assume
there were some weird control characters pasted or something.
That's why I typed it in. It looks like this:
.html
<wo:form>
<wo name="FormValuesObserveField">
First Name: <wo name="FirstNameFilterText"/>
Last Name: <wo name="LastNameFilterText"/>
</wo>
<wo name="ResultsContainer">
<p>Last: <wo:str value="$lastNameFilter"/></p>
<p>First: <wo:str value="$firstNameFilter"/></p>
</wo>
</wo:form>
.wod
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";
}
.java
public String firstNameFilter;
public String lastNameFilter;
On May 29, 2010, at 1:52 PM, Joe Kramer wrote:
I do have this whole component wrapped in a WOForm. In addition to
the fields I described there are a couple of WOSubmitButtons that
submit the whole form (cancel and save type actions).
Thanks,
Joe Kramer
CyberApps, Inc.
On Sat, May 29, 2010 at 10:45 AM, Ricardo J. Parada
<email@hidden> wrote:
Do you have a WOForm wrapping the text fields?
On May 29, 2010, at 12:56 PM, Joe Kramer wrote:
Hi Farrukh,
Thanks for your reply. I moved the AjaxObserveField inside the
AjaxUpdateContainer, but I'm still getting the same behavior where
values that haven't just been set are set to null instead of
maintaining their previous values. Any other ideas?
I can hack a solution where I just won't do anything in the setter
if the value is being set to null, but the issue there is if the
user deletes all the text in an input field, then the result list
will not get updated to display all the values.
Thanks again for any help,
Joe Kramer
CyberApps, Inc.
On Sat, May 29, 2010 at 9:35 AM, Farrukh Ijaz <email@hidden
> wrote:
Try move the FormValuesObserveField component inside the
ResultsContainer and test it.
<webobject name = "ResultsContainer">
<webobject name = "FormValuesObserveField">
<div class="formInput">First Name: <webobject name =
"FirstNameFilterText"/></div>
<div class="formInput">Last Name: <webobject name =
"LastNameFilterText"/></div>
</webobject>
... (list of results)
</webobject>
On 2010-05-29, at 7:30 PM, Joe Kramer wrote:
Hi everyone,
Sorry to be a bother, but I was wondering if anyone had any ideas
for me on this issue. If it would help, I could attach a small
example app that demonstrates this behavior.
Thanks for any help,
Joe Kramer
CyberApps, Inc.
On Thu, May 27, 2010 at 8:00 AM, Joe Kramer
<email@hidden> wrote:
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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden