-
1. Re: Add Dynamic Row
mcmurdosound Oct 17, 2011 2:01 AM (in response to omidbiz)Just add another entry to your List and reRender the table?
-
2. Re: Add Dynamic Row
omidbiz Oct 17, 2011 9:32 AM (in response to mcmurdosound)i think, i didn't explain my problem well enough
i have a datatable and a button as below
<input type="button" onclick="addRowToDataTable()" value="Add Row"/>
<rich:dataTable value="" var="_contact" id="dt">
<rich:column>
</rich:column>
</rich:dataTable>
i want to everytime a user clicks on button, a row will be added to table dynamically as well as i want to get all rows entry at server
i have no idea how can i implement this in richfaces
-
3. Re: Add Dynamic Row
mcmurdosound Oct 17, 2011 10:15 AM (in response to omidbiz)Hi,
your button has to call an action in your backing bean to add a new row to your datamodel:
<a4j:commandButton value="add Row" action="#{myDataModelBean.add}" reRender="myTable"/>
<rich:dataTable value="#{myDataModelBean.dataList}" var="r" id="myTable">
<rich:column>
#{r}
</rich:column>
</rich:dataTable>
your "onclick=..." is just javascript code.
Or do you want to add rows on client side and synchronize later with the backingbean?
-
4. Re: Add Dynamic Row
omidbiz Oct 18, 2011 2:16 AM (in response to mcmurdosound)Thanx for your reply,
Actually I'm writing a richfaces component via CDK and it's combination of these two feature (dataTable and commandButton), so that would be better if it was client side
is it possible to add rows on client side and synchronize later with the backingbean?