Instead of using javascript, can you just use the
t:updateActionListener tag? It works quite well for data table rows.
On 5/29/06, Stefan Gesigora <[EMAIL PROTECTED]> wrote:
Hi!
How can I pass a value set with javascript (f.e.):
"document.getElementById("form:selListRow").value = idrow"
into my backing-bean?
I got a datatable where the user can select a row. The selected row is highlighted and
then the user can press an "addRow"-commandLink (with image) which add the
selected row to another table.
The row selection and reading the selectedRow-id works. I can set the idrow via js to the
hidden inputfield "selListRow". But the setter of the backing-bean attribute
used in this hidden inputfield were never called.
What should I have to do?
Thanks,
Steven
here's my code:
---snip--
...
<script language="JavaScript" type="text/javascript">
function colorizeRow(idrow) {
var rsListSize =
document.getElementById("form:rsListSize").value;
if (rsListSize != null && rsListSize != ""){
for (var i = 0; i < rsListSize; i++){
if (i % 2 == 0){
document.getElementById(i).className =
"standardTable_Row1";
} else {
document.getElementById(i).className =
"standardTable_Row2";
}
}
}
document.getElementById(idrow).className =
"standardTable_Row1_Selected";
document.getElementById("form:selRsListRow").value = idrow;
}
</script>
...
<h:inputHidden id="rsListSize" value="#{searchBean.resultListSize}"/>
<h:inputHidden id="selRsListRow"
value="#{searchBean.rsListSelRow}"/>
...
<t:dataTable styleClass="standardTable"
headerClass="standardTable_SortHeader"
footerClass="standardTable_Footer"
rowClasses="standardTable_Row1,standardTable_Row2"
var="person"
value="#{searchBean.resultList}"
sortColumn="#{searchBean.sort}"
sortAscending="#{searchBean.ascending}"
preserveDataModel="true"
preserveSort="true"
style="vertical-align:top;"
rowCountVar="rowCount"
rowIndexVar="rowIndex"
rowId="#{rowIndex}"
rowOnClick="javascript:colorizeRow(#{rowIndex});">
...
<h:commandLink actionListener="#{searchBean.doAdd}" immediate="true">
<t:graphicImage value="/images/runter.gif"/>
</h:commandLink>
...
---snip---
--
Bis zu 70% Ihrer Onlinekosten sparen: GMX SmartSurfer!
Kostenlos downloaden: http://www.gmx.net/de/go/smartsurfer