gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 07:51:06 27 4
gpt4 key购买 nike

我正在使用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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com