From: Thomas Wedderburn-B. <web...@bi...> - 2008-12-22 07:08:55
|
Yes, I tried connecting the list binding to something meaningful, and it didn't work, which is why I connected it to an instance variable. But that means I have to set the variable each time through the loop: public void setAChecklistGroup(ChecklistGroup g) { aChecklistGroup = g; if (g!=null) _items = (NSArray <ChecklistItem>)g.toChecklistItems().valueForKeyPath("@sort.sequence"); } Note that this is not a KVC thing, because I had a method setItems(NSArray<ChecklistItem> items) but that was never called by the component when it changed the array-- it poked it directly into _items without using an accessor. Regards Thomas On 22/12/2008, at 5:23 PM, Paul Hoadley wrote: > On 22/12/2008, at 3:09 PM, Thomas Wedderburn-Bisshop wrote: > >> that's the weird part, and I forgot to mention it. I have an _items >> instance variable (not items) which is set directly, and does not >> call an accessor method: >> >> public NSArray<ChecklistItem> _items; >> >> ... >> >> public WOComponent reorderItems() { >> aChecklistGroup.resequence(_items); >> return null; >> } >> >> So it seems to me that AjaxSortableList is poking the value directly >> into the _items variable, even though the binding is given as >> "$items". > > Maybe I'm a little slow today, but I seem to still be missing a > step. How is _items providing the inner component with the content > for each repetition of the outer component? That is, I've got this: > > <wo:AjaxSortableList id="sectionList" list="$sectionList" > item="$sectionIter" listItemIDKeyPath="id" action="$orderChanged"> > <wo:string value="$sectionIter.name" /> > <wo:AjaxSortableList id="$idForItemList" list="$itemList" > item="$itemIter" listItemIDKeyPath="id" action="$orderChangedForItem"> > → <wo:string value="$itemIter.question" /> > </wo:AjaxSortableList> > </wo:AjaxSortableList> > > where itemList() returns an NSArray for each value of sectionIter: > > public NSArray<Item> itemList() { > return sectionIter.sortedItems(); > } > > While that seems to set up the display of the lists just fine, at no > point do I seem to get my public NSArray<Item> itemList containing > anything other than null when orderChangedForItem() is called, > whether I call it itemList, _itemList, or provide > setItemList(NSArray<Item> list) to set it. > > Thomas, if you have time, could you show me a bit more of your code > (component and Java)? > > > -- > Paul. > > w http://logicsquad.net/ > h http://paul.hoadley.name/ > > |