Hi Andrei,

Controls need to be reachable from the Page itself. You can do this by either 
adding the link to the
Page or by adding the link to a Container.

>From what you describe I think you are only adding the links to the ArrayList 
>itself so the Page is
not aware of the links and can't process them. Here is a short example:

  public MyPage...

  public void onInit() {
    for(int i = 0; i < 10; i++) {
      String name = "link" + i;
      ActionLink link = new ActionLink(name);

      link.setActionListener(new ActionListener() {
        public boolean onAction(Control control) {
          return true;
        }
      });

      addControl(link);
      list.add(link);
    }
  }

Hope this helps.

Kind regards

Bob

On 10/06/2010 06:58, Andrei wrote:
> I need to show links, which i need to populate dynamically
> 
> @Bindable protected List<ActionLink> scripts = new ArrayList<ActionLink>();
> 
> I fill ArrayList with links, which i create in onInit() and then show
> them in Velocity using #foreach
> 
> For each link i set listener
> 
> link.setActionListener(new ActionListener() {
>             public boolean onAction(Control control) {
>              return true;
> }
> 
> But onAction never get called when i click on links
> 
> What do i do wrong here?
> Thanks
> 

Reply via email to