1

我想知道如何以编程方式设置从我的支持 bean 中选择的 ExtendedDataTable 中的行。我需要在我的网络应用程序中编辑用户。用户有一些角色,所以我想要的是在加载页面时在扩展数据表中选择用户拥有的组。

我将 Spring3 与 JSF 2 和 Richfaces 4 一起使用。

我想我需要将表绑定到请求范围内的支持 bean。我可以为此使用 Spring 请求范围吗?之后我需要在我猜的数据表上实现 walk() 。我不知道从那里去哪里,有人可以指出我正确的方向或给我一个例子吗?

问候,

德克

4

1 回答 1

1

这是我的一段代码。这行得通,我看到“rowdata 等于对象”日志语句,但现在我需要对“选定”行说,但据我所知,没有一种方法......我该如何做到这一点?

public void selectRows(){
          Collection<Object> s = new ArrayList<Object>(getGroups());
  log.debug("set the selection to the table");

          table.getTable().walk(FacesContext.getCurrentInstance(), new DataVisitor() {

  @Override
               public DataVisitResult process(FacesContext context, Object rowKey,
                         Object argument) {
  log.debug("entered walk");
                    Collection<Object> selection = (Collection<Object>) argument;
                    for(Object o : selection){
                         table.getTable().setRowKey(rowKey);
                         if(table.getTable().getRowData().equals(o)){
  log.debug("rowdata equals object");
                              table.getTable().getSelection().add(o);
                              log.debug("size of selection is: " + table.getTable().getSelection().size());
                         }
                    }
                    table.getTable().setRowKey(rowKey);
  return null;
               }
          }, s );
     }
于 2011-09-20T11:22:53.107 回答