我有一个这样定义的数据表:
<div style="margin-top: 10px; padding: 3px 3px;">
<fieldset>
<legend>SourcePublicationDates</legend>
<f:facet name="header" >
<h:outputText value="Add SourcePub date:"/>
</f:facet>
<h:inputText id="sourcePublicationDate" value="#{dataEntry.sourcePublicationDate}">
<c:ajax event="keyup" />
<c:ajax event="focus" />
<f:ajax execute="@this" render="sourcePublicationDate" />
</h:inputText>
<h:panelGroup style="padding-left: 3px;">
<button class="manualContent" id="showSourcePublicationDateCalendar" type="button"><img src="/sourceNavigateWeb/resources/images/cal.gif"/></button>
<div id="sourcePublicationDateCalendarContainer" />
</h:panelGroup>
<h:commandButton value="Add" action="#{dataEntry.editSourcePubDates}">
<f:ajax execute="@this" render="dtSourcePubDate" />
</h:commandButton>
<h:dataTable id="dtSourcePubDate" value="#{dataEntry.sourcePubDates}" var="sourcePubDate">
<h:column>
<f:facet name="header" >
<h:outputText value="Source Publication Dates:"/>
</f:facet>
<h:inputText id="sourcePubDate" value="#{sourcePubDate}"/>
</h:column>
</h:dataTable>
</fieldset>
</div>
该表中的值来自一个多选日历控件,我最终在下面的 javascript 中获得了该控件。我想将每个单独的 fullDate 显示到数据表的文本框字段部分中,该字段最终绑定到 jsf 支持 bean。如何将 fullDate 放入 datatable 的文本框字段中?甚至是不可编辑的数据表形式?
CalendarPopup.handleSelectForMultipleDates = function(type, args, obj, inputEl)
{
var arrDates = CalendarPopup.sourcePublicationDateCalendar.getSelectedDates();
var length = arrDates.length;
var i=0;
while(i!=length)
{
var date = arrDates[i];
var displayMonth = date.getMonth() + 1;
var displayYear = date.getFullYear();
var displayDate = date.getDate();
var fullDate = displayMonth + "/" displayDate + "/" + displayYear;
i++;
}
}