5 Replies Latest reply on Jul 4, 2011 8:36 AM by Sukhendu Roy

    Dynamic Link and Buttons doesnt work inside richTable

    Manjunath Kaliyur Newbie

      HI,

      First of all, thanks for the great components.

      I have an issue with dataTable - I need to dynamically create HtmlCommandLink and HtmlCommandButtons with binding attributes and display them inside richTable columns. The Links and buttons works outside the table with same method bindings, but doesnt fire actions or action listeners if placed inside the richTable. Note that the richTable itself if created dynamically by programmactically creating UIDataTable.

      The code snippets for dynamic links and buttons are below ..


      HtmlCommandLink cl = new HtmlCommandLink();
      
      MethodExpression mexCol0=context.getApplication).getExpressionFactory().createMethodExpression(context.getELContext(), "#MappEnvService.dummy}", String.class, new Class<?>[0]);
      
      cl.setValue("SelectRow");
      cl.setActionExpression(mexCol0);
      HtmlPanelGrid pg = new HtmlPanelGrid(); //for testing only
      pg.setColumns(1);
      pg.getChildren().add(cl);
      
      HtmlInputNumberSpinner tspn = new HtmlInputNumberSpinner();
      tspn.setMaxValue("10");
      tspn.setMinValue("0");
      
      HtmlCommandButton btn = new HtmlCommandButton();
      btn.addActionListener(new MappGridTab());
      
      btn.setValue("Test");
      MethodExpression mexCol1=context.getApplication().getExpressionFactory().createMethodExpression(context.getELContext(), "#{MappEnvService.dummy}", String.class, new Class<?>[0]);
      
      
      btn.setActionExpression(mexCol1);
      pg.getChildren().add(tspn);
      
      pg.getChildren().add(btn);
      
      
      col.getChildren().add(pg);
      columnList.add(col);
      
      


      The spinner control works fine within the columns - Not sure why only Link or button shouldnt work - On click of button or link, request goes to server, and page refreshes as if the action return is null - but doesnt display any log messages in action method or action listener.

      Same Link or button works fine if outside the dataTable.

      I appreciate any feedback on what mistake I'm doing. . do I need a new form around each link?

      Manju