【发布时间】:2013-01-05 19:35:13
【问题描述】:
我正在使用 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,并且我尝试对任何搜索结果调用 delete 方法,则会在旧 id 上调用 delete 方法 >> @ 987654323@
city.id搜索后未更新。
请指教,谢谢。
【问题讨论】:
标签: java jakarta-ee jsf-2 icefaces icefaces-3