我有jsf页面使用ACE数据库。我需要根据条件给行上色,所以我使用了datatable的rowStyleClass属性。
<ace:dataTable value="#{bookingListAndEditController.bookingList}"
rowStyleClass="#{booking.pickupTime.before(bookingListAndEditController.currentDate)?'jsfcrud_odd_row':null}"
var="booking" filterEvent="enter" paginator="true" rows="20" selectionMode="multiple"
rowSelectListener="#{bookingListAndEditController.rowSelected}"
rowUnselectListener="#{bookingListAndEditController.rowUnselected}" stateMap="#{bookingListAndEditController.stateMap}">
但它似乎不起作用。谁能告诉我我做错了什么吗?
始终记住,var booking
是bookingList
的对象,仅对ace:dataTable
的子元素可用。对所有列重复此styleClass,以便将样式应用于整个行,并且仅应用于预订拾取时间小于当前时间的行。
<ace:dataTable value="#{bookingListAndEditController.bookingList}"
var="booking" filterEvent="enter" paginator="true" rows="20" selectionMode="multiple"
rowSelectListener="#{bookingListAndEditController.rowSelected}"
rowUnselectListener="#{bookingListAndEditController.rowUnselected}" stateMap="#{bookingListAndEditController.stateMap}">
<ace:column styleClass="#{booking.pickupTime.before
(bookingListAndEditController.currentDate)?'jsfcrud_odd_row':''}">
..
</ace:column>
.......
<ace:column styleClass="#{booking.pickupTime.before
(bookingListAndEditController.currentDate)?'jsfcrud_odd_row':''}">
..
</ace:column>