Re: WORepetition & synchronization - <SOLVED>
Re: WORepetition & synchronization - <SOLVED>
- Subject: Re: WORepetition & synchronization - <SOLVED>
- From: Anthony Arthur <email@hidden>
- Date: Wed, 2 May 2007 20:44:54 -0400
72 hrs later -- wow what a relief!!
For anyone who cares to know, the solution was replacing a
WOSubmitButton with a WOHyperlink. All credit for this one goes to
David Coyle who made the suggestion. Without knowing why this makes
a difference my first suspicion is that this is a bug. Meanwhile, of
all the many times I have reliably used the repetition element, this
is first time it failed me..., hope no one else ever suffers the same
hardship.
Now, does anyone have a nice edit button graphic to enclose in a
link? Meanwhile, the link will do, thank you very much!!
--Brian
On Apr 29, 2007, at 11:40 PM, Chuck Hill wrote:
On Apr 29, 2007, at 5:27 PM, Anthony Arthur wrote:
Does this make sense to anyone....
As I continuously change and test this problem I became suspicious
that what was happening was that the repetition was determining
which item in the array I was selecting based on the dayName
attribute instead of the eo address,
Have you set the name binding for any of web objects inside of the
repetitions? This will usually get you in trouble.
Chuck
which I know sounds absurd. Meanwhile, my theory was based on the
behavior that when selecting Sunday from week 2 the repetition
would think I picked Sunday from week 1, so it was just finding
the first Sunday in the list. If there were 3 wks and I picked
Sunday week 3, it would probably still think I was picking week 1
- frightening. So to test this theory, I appended the week value
to the dayName value while creating each day eo, then picked
Sunday week 2, and it worked! Why?? Shouldn't the mechanics of
how this works to determine which selection was made in the
repetition be based on the object address?
Any input from anyone would be really really great about now....
--Brian
On Apr 29, 2007, at 4:42 PM, Anthony Arthur wrote:
Thanks for your reply. Your second example best matches my
object graph. Here's more details using your illustration:
/////////////////////////////////////////////////
//
In my java class:
public ParentEOClass parentOfDay;
public Day dayItem;
public int weekDayIndex;
....
public WOComponent editDayAction() {
WOComponent nextPage = pageWithName("DayEditPage");
page.setDay(dayItem);
return page;
}
//
/////////////////////////////////////////////////
/////////////////////////////////////////////////
//
In my wod definition:
WORepetition: WeekDays {
list = parentOfDay.toManyDays;
item = dayItem;
index = weekDayIndex;
}
WOString: DayName {
value = dayItem.value; //value returns a the week day name as a
string
}
WOString: WeekNbr {
value = dayItem.week; //week returns either 1, 2, 3, or 4
}
WOSubmitButton: EditButton {
action = editDayAction;
}
//
/////////////////////////////////////////////////
So to answer your question:
>> if your days array is the second example what do you bind as
value? dayItem
dayItem is an eo instance contained in the to-many relationship
toManyDays on parentOfDay, and value (or weekDayName) can be
bound to any WOString element where I want to display the name of
the week day.
Since my last message, I have investigated more and this is what
I am finding. First, I incorrectly reported that the index was
being set correctly. It's not. So for example, if I click the
edit button for Sunday/Week 2, the index will equal 0 instead of
8. Also, I implemented a set method for dayItem, instead of just
letting KVC set the ivar, so I could get a better idea of what
happens after I click the edit button. I would expect this set
method to be called for every eo in parentOfDay.toManyDays, which
it does, and it only iterates over the list once, but it makes
'n' extra calls past the last item in the array, given my example
of selecting a day in week 2, depending on which day in week 2 I
select. So for example, if I select Monday/Week 2, my setter is
called for every day in week 1 & 2, Sunday-Saturday & Sunday-
Saturday, but then it is called 2 more times, first with Sunday
week 1 then Monday week 1, then edit page renders with Monday
week 1 selected instead of Monday week 2 as I would expect. If I
had select Sunday Week 2, to edit, I get the same behavior except
we get one extra call to my setter. For Tuesday/Week 2, there
would be 3 extra calls, and so on...., however at the same time,
using NSLog in debug mode, I can see that the contents of the
array bound to the repetition, parentOfDay.toManyDays, only holds
the 14 days I would expect, no more.
Hope I am not getting too bogged down in the details here.
-b
On Apr 29, 2007, at 3:42 PM, Daniele Corti wrote:
2007/4/29, Anthony Arthur <email@hidden>: Apologies if this
has already been covered, but I can't find it. I
am trying to get other's insight on a problem I've never seen
before,
and I've seen a lot.
I have an array of eos that represent days of the week. These days
are displayed vertically, with days bound to the repetition's list
and dayItem bound to item and a counter on the index binding. The
days could span 1, 2, 3, or 4 weeks and each day eo has a week
attribute that holds 1, 2, 3, or 4. The repetition builds rows
in a
table showing weekday name, week #, and an edit button, among other
things. The edit button returns a separate page where certain
attributes of the selected day can be changed.
ok, maybe i'm not undestand it very well:
do you have:
days = {eo1={value=Monday, weeks={1,2}}, eo2={value=Tuesday,
week={1,2}},...,eo7={value={Sunday}, week={1,2}}}
or:
days = {eo1={value=Monday, week=1}, eo2={value= Tuesday,
week=1},...,eo7={value={Sunday}, week=1}, eo8={value=Monday,
week=2}... eo14={value=Sunday, week=2}}
?
Ok, here is what happens. Say I am displaying 2 weeks, or 14
days. I
click the edit button of a day in week 2, yet the eo in my edit
page
is the same day in week 1. The edit button's action binding
calls a
method with 3-4 lines of code that just creates the next page,
passes
it the value bound to my item binding of the repetition, and
return.
Ok, if your days array is the second example what do you bind as
value? dayItem?
The table displays properly, where the week # displays as I would
expect, meaning that week 2 is displayed with the row where I click
the edit button, but somehow when I click it, the variable bound to
item is pointing to the same day in week 1--WTF? Also, I
checked my
index binding, and it has the correct value. So anyone got a clue.
I have burned an entire weekend on this, and would really like to
solve it and move on.
Thanks,
--Brian
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ( email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
--
Daniele Corti
AIM: S0CR4TE5
Messenger: 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:
40mac.com
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:
40global-village.net
This email sent to email@hidden
--
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