2 Replies Latest reply on Jan 29, 2008 4:55 AM by Ilya Shaikovsky

    Problem setting ActionExpression

    Sergio Del Valle Newbie

      Hi all, I'm trying to create a page segment by creating objects in Java code, so I created a jspx as following

      ...
       <rich:panel binding="#{mainPanel}"/>
      ...


      The mainPanel class is defined as

      public class MainPanel extends HtmlPanel {
       public void generatePanel() {
       ...
       HtmlForm form = new HtmlForm();
       form.setId("listForm");
      
       HtmlDatascroller scroller = new HtmlDatascroller();
       scroller.setId("listScroller");
       scroller.setFor("listTable");
       scroller.setMaxPages(15);
       scroller.setStyle("width: 100%");
       scroller.setAjaxSingle(true);
       scroller.setRenderIfSinglePage(false);
       form.getChildren().add(scroller);
      
       HtmlDataTable dataTable = new HtmlDataTable();
       dataTable.setId("listTable");
       dataTable.setRows(20);
       dataTable.setWidth("100%");
       dataTable.setVar("item");
       DataModel dm = new DataModel(schema, values);
       dm.addDataModelListener(this);
       dataTable.setValue(dm);
       HtmlAjaxSupport support = new HtmlAjaxSupport();
       support.setId("rowAction");
       support.setActionExpression(Util.createMethodExpression(
       "#{mainPanel.selectRow}", String.class));
       support.setAjaxSingle(true);
       support.setEvent("onRowClick");
       support.setReRender("tabPanel");
       dataTable.getChildren().add(support);
       ...
       }
      
       public String selectRow() {
       ...
       }
      }


      The mainPanel bean scope is session

      The problem I'm having is the method selectRow is never called when I click on a row in the table, I have tried also implementing the DataModelListener interface in MainPanel, and adding dm.addDataModelListener(this); in the datamodel definition, having same result. Also tried implementing ActionListener, and adding support.addActionListener(this); to the ajaxsupport definition.

      I don't know what I'm doing wrong.

      Thanks in advance.

      Sergio