java - 王牌 :dataTable search dose not update command button action

标签 java jakarta-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));
    }

}

问题:

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

请指教,谢谢。

最佳答案

此问题已在 icefaces 3.2.0 中解决

关于java - 王牌 :dataTable search dose not update command button action,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14460805/

相关文章:

java - 在 MF8 分析控制台中获取日志记录需要哪些配置?

Java:当 GUI 应用程序启动时,保存的首选项设置不会恢复

java.lang.IllegalStateException : Could not execute method for android:onClick/Android 错误

java - 如何从数据库中返回大量数据给网页客户端?

java - 使用 hibernate 标准查询 CLOB 列

java - JSF:PanelGrid 不会呈现

Java程序向后打印字符串

jsf-2 - Jsf 自定义转换器生命周期

java - Primefaces - 如何获取 CellEditEvent 的列

java - hudson : Builds Taking Longer time than What it takes by running it Locally