<h:dataTable width="100%" border="1" cellspacing="0"
cellpadding="2" style="border-collapse:collapse;display:block"
styleClass="Header" value="#{adminBean.displayResults}"
var="aResult" binding="#{adminBean.browseResultsHTMLDataTable}">
This is what i am trying to do. I have a dynamic list of data, which i try to display in the HTML Table format using h:dataTable (the bounded value is an arrayList). The table has got a radio button for each row it displays (boolean w/ h:selectOneRadio ) now when i select the radio button in one of these rows, i want to get the values of the row that is selected for which i try to use binding attribute. But i get Row Unavailable exception - is my approach wrong? any suggestions?
Selecting rows by radio button in a datatable is a tricky task since the radio buttons aren't grouped. Long story short: Select row by radio button.
I think you can use <t:selectOneRadio> with layout="spread" and then <t:radio> on each row.
Related
I have p:dialog, inside there is p:panelGrid, and one of column is p:dataTable. Datatable has selectionmode single. Problem is: dataTable loses all styling it defaulty had (it looks like pure unstyled html table). Also when i click row in dataTable, row is invisible, no data is shown. Also rowSelect functionally works, because data from selected row displays in input fields in another outputPanel correctly. Its just invisible
Currently i'm stuck in create two dropdown list in jsf by click a "Add" button.
Initial i have a form with two dropdownlist, a "Add" button and a "submit" button.
The first dropdownlist is list country. The second dropdownlist is list city.
When user choose a country then the second dropdownlist will add dynamic city of this country(i done this using ajax f:ajax).
how can i add two other dropdownlist(list country and list city also) when add button clicked?(it mean user can add a lot of pair dropdownlist using add button)
how about structure of bean to manage all pair dropdownlist when i click submit button?
Please give me some example code to do it.
Thanks
Have you tried using c:forEach? Similar to the following:
<c:forEach var="i" begin="1" end="#{bean.numberOfAddsCLicked}" step="1">
<!-- Your elements to repeat here. Probably bind their values to bean.country[i] respective bean.city[i] with country and city being arrays of bean.numberOfAddsCLicked -->
</c:forEach>
I have a rich:extendedDataTable and a a4j:commandButton outside this table. When clicking the button, I want to rerender only one row and not the whole table so that the scroll remains on my selected row.
For that, I implemented the solution proposed on this other thread: reRender a specific row of rich:dataTable
It worked but it has a terrible side effect. I only rerender one cell and upon being rerendered, the cell shows a bit odd and it's not aligned anymore with the rest. Checking the source, I noticed that this rendered cell now has a <td class="rich-table-cell"...>and the other cells have <td class="extdt-cell rich-extdt-cell" ...>. So the rerender gives my cell a rich:dataTable class name instead of the rich:extendedDataTable class name that it belongs to.
Any ideas why and what should I do to have it rerender with the correct class?
I'm trying to achieve the well known feature of being able to select a datatable's row by using a radio button.
I have followed this blog:
http://balusc.blogspot.com/2006/06/using-datatables.html#SelectRowByRadioButton
It works perfectly if there is one datatable on the form, but when I add another one (even if it's placed on other form), and try to select a row there, the radio button gets selected then instantly unselected. The data is correctly set on the backing bean though.
Any ideas about how to extend the results of the above blog on more than one datatable?
Thank you
That script will group all radio buttons with the same component ID in the same form. So to fix your particular problem, put the other data table in a different form or give the other <h:selectOneRadio> a different ID.
I am using rich faces data table tag in my jsf:
<r:dataTable id="dataTable" var="user" preserveDataModel="false"
value="#{ListUsersManagedBean.users}" rows="10"
rowId="#{user.firstName}" rowKeyVar="index"
width="500" style="float:centre" reRender="ds" columnClasses="center">
Here i have configured rowsize as 10 in static way.I want to give the user a dropdown in the table so he can select number of rows 100,200,300,400 etc below the column.How can i do this.Or any better solution?
Thanks
You can do that by binding a variable to rows like rows = #{yourBean.noOfRows} and same to the combo box, and reRender your datatable onChange of comboBox.
This can be done if you are strict to use <rich:dataTable> or you can use jQuery datatable easy to integrate and easy to use for the functionality you need.