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