When I add a row from "Create.jsf" page and I go to "List.jsf" to see the datatable I get the same result before adding the row.
I have two solutions :
1 - I must clean browser cache everytime I want to see the new row or add a button to update the datatable.
Or I change the Controller from SessionScope to RequestScope (it works but it's not a good idea because it takes a lot of time to load the list everytime).
any other solution please ?
Thank you :)
Related
every row I have a commandbutton for editing the row. The method action of this commandbutton sets a managed bean property to hide the datatable and to show the edit form. I do this by enclosing the datatable in a panelgroup, and the edit form in another one, and setting the rendered attribute of the panelgroups accordingly to the managed bean property.
The managed bean is Viewscoped, and all the requests I have are non-ajax.
When I click the edit commandbutton on a row of the 1st datatable page, everything works ok.
But if I move to another datatable page using the paginator links, and then I click the edit commandbutton on any row of the page, it doesn't work, because the Viewscoped bean is created again (PostConstruct is triggered), and even I can see that the action method of the clicked commandbutton isn't executed.
I think it has to do with the ajax requests of the paginator (I guess).
Anybody knows how to make it work?
The problem is with the rendered attribute. Take a look here.
A beter way of solving your problem is to make an editable datatable, or if your object is more complex, make your edit page a dialog, and open it with your edit button.
I am making datatable in JSF using (dataTable tag).
I am having several rows in that with check box( selectBooleanCheckbox ) in front of every record.
I have commandLink button for selecting all check box and deselected all check box..
i am trying to select/unselect all checkboxes in the datatable using a single commandLink. As I am trying to set it on the server, I am unable to do so. I have looked around for solutions but could not get how to accomplish on the server side.
thnks
In my jsf page, there is a table using rich:dataTable, each row of table has a h:selectBoolenCheckbox, I want to use it to check some rows and then click a button to trigger action only for the checked rows.
And also there is a4j:poll component used in this page, every 15 seconds the table data will be refreshed. After that problem is coming:
my a4j:poll will invoke an action to load the latest data, the loading time need 2-4 seconds. If I click some checkbox to select some rows during the loading period, the checked checkbox will be lost after loading finish.
So do you met the same problem and how to avoid it?
Just don't update the whole table. Update only the cells which really need to be updated. You can use EL in reRender (RF 3.x) or render (RF 4.x) attribute of <a4j:poll> to dynamically populate a spaceseparated string of client IDs of all cells.
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 an extendedDataTable from Richfaces 4. I want to show a detail-page for the element in a row when the user clicks it. Therefore I have added something like
onrowclick="showDetails(#{item.id})"
to the table. This triggers a corresponding <a4j:jsFunction/> tag. This is working so far.
However, one of the columns has a commandLink in it (for switching to an edit-view of the details). The link works in webkit-based browsers (Chrome/Safari). But IE and firefox only execute the onclick on the row. The commandlink doesn't work there.
Is it somehow possible to only set an oncolumnclick or the columns, that do not contain the commandlink? I havn't found a way to add an onclick-handler to specific columns (I am using rich:column for the columns.)
Or is there a better/cleaner/nicer way to achive the "click somewhere in the row to show details, click the link in the last column to show the edit view"-behaviour I am after?
Try putting this in your commandButton
onclick="Event.stop(event||window.event)"
My current workaround HACK is to not use the onrowclick but add a styleClass="clickable" to all my columns except the one with the link. In the first column, I added the following:
<h:outputText value="#{item.id}" style="display: none;" styleClass="id"/>
Then after the table I use the following jQuery:
<rich:jQuery selector=".myTable td.clickable" query="live('click', function(event) {
showDetails($(this).parent().children().children('.id').text());
});"/>
I really don't like this solution, but it is working fine so far.
I am still open for better solutions though :)