ace:dataTable搜索不更新命令按钮操作

时间:2013-01-22 14:25:42

标签: java java-ee jsf-2 icefaces icefaces-3

我正在使用 icefaces版本3.0.0 ,我正在使用ace dataTable组件,如下所示:

1- Jsf代码:

<ace:dataTable id="cityTable"
                              value="#{weatherBean.cities}"
                              var="city"
                              paginator="true"
                              paginatorPosition="bottom"
                              rendered="#{weatherBean.cities.size()>0}"
                              rows="#{weatherBean.pageSize}"
                              style="width: 950px;">


                         <ace:column id="country" headerText="Country" sortBy="#{city.countryName}"
                                    filterBy="#{city.countryName}" filterMatchMode="contains">
                            <h:outputText id="countryNameCell" value="#{city.countryName}"/>
                        </ace:column>



                        <ace:column id="action" headerText="Actions">
                       <sec:authorize access="hasRole('perm_edit_city')">                       
                            <pretty:link mappingId="editcity">
                                <f:param value="#{city.id}" />
                                <h:graphicImage url="/resources/images/edit.png" style="border: 0px;"></h:graphicImage>
                            </pretty:link>
                        </sec:authorize>        
                            <b/>
                            <sec:authorize access="hasRole('perm_delete_city')">
                                <h:commandButton id="deleteR" image="/resources/images/delete.png"
                                     action="#{weatherBean.deleteCity(city.id)}" 
                                     onclick="var r=confirm('Are you sure you want to delete #{city.name} ?');if (r==true){}else{return false; }"
                                     >
                                </h:commandButton>
                            </sec:authorize>
                        </ace:column>

                    </ace:dataTable>

2-支持bean代码:

@Component("weatherBean")
@Scope("view")
public class WeatherBean {

private List<City> cities;

@Autowired
private CityService cityService;

    @PostConstruct
    public void init() {
            cities = cityService.getAllCity();
    }

    public void deleteCity(Long cityId) {
        log.debug("Delete deleteCity : " + cityId);
        cityService.deleteCity(cityService.getCityById(cityId));
    }

}

ISSUE:

  • 数据表默认显示从id 1到id 20的城市。
  • 如果我按名称搜索,并搜索返回的结果,例如ID为100到id 120,并且我尝试在任何搜索结果上调用delete方法,则在旧的ID上调用delete方法&gt;&gt ; action="#{weatherBean.deleteCity(city.id)}"搜索后city.id未更新。

请告知,谢谢。

1 个答案:

答案 0 :(得分:1)

icefaces 3.2.0

解决了这个问题