Stewart, Gary wrote:
> Hi there,
>
> I've got a repeater with two selection lists in; staffmemeber and
> staffrole. Upon a value being changed on the staffrole or another
> selection list outside of the repeater (department) the list of staff
> members change. I'm using an on-changed-value on the staffrole
> repeater and that works fine but I'd also like to change the list if
> the department is updated for all the rows in the repeater using
> javascript on the department's on-changed-value event.
>
> I tried something like:
>
> var staff_list = event.source.parent.lookupWidget("stafflist").getChildren();
> var staff_item = null;
> var staff_member = null;
> var staff_role = null;
> while(staff_list.hasNext())
> {
> staff_item = staff_list.next();
> staff_member = staff_item.lookupWidget("staffmember");
> staff_role = staff_item.lookupWidget("staffrole");
> //set a new staff member event
> }
>
> but I got stuck at the first hurdle. That is that it looks like
> stafflist doesn't actually have any children (hasNext() returns
> false). It certainly should have. If it does have children is it then
> possible to do the latter logic of getting each child and looking up
> the components I want to get the value of and change the values of?
>
> Is there a different or better way that I should do this?
I think to get the rows from a Repeater you have to use getRow() rather
than getChildren(). I think I've used something like this in the past:
var repeater = ...
for(var i=0; i<repeater.getSize(); i++) {
var row = repeater.getRow(i);
...
}
Hope that works
Actually the Javadoc for Repeater doesn't even look like it has a
getChildren() method, so I'm not sure why you weren't getting an error.
It seems odd that Repeater doesn't implement ContainerWidget; even its
Javadoc says it should. Interesting.
--Jason
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]