1 Reply Latest reply on Apr 18, 2008 7:52 AM by Volker Schmidt

    dataTable sorting does not work when using binding

    Volker Schmidt Newbie

      Hi.

      I'm facing a problem with the dataTable. If I enable sorting by using the sortBy attribute of a column it works fine (on jsp side). But if I create the column dynamically as HtmlColumn in the managed bean and click on the sort icon, it doesn't do anything - no sorting, no error shown. Here is a part of the code:

      private void addColumn(String attribute, String columnHeader, Class<?> expectedReturnType) {
       HtmlColumn column = new HtmlColumn();
       HtmlOutputText header = new HtmlOutputText();
       header.setValue(columnHeader);
       column.getFacets().put("header", header);
       column.setValueExpression("sortBy",
       JSFUtils.createValueExpression("item",
       attribute, expectedReturnType));
      
       HtmlOutputText output = new HtmlOutputText();
       output.setValueExpression("value",
       JSFUtils.createValueExpression("item",
       attribute, expectedReturnType));
       column.getChildren().add(output);
      
       this.dataTable.getChildren().add(column);
       }
      


      The JSFUtils.createValueExpression returns a ValueExpression instance.