I am a newbie with JSF. Currently I have the problem with keeping the state of data-table list pagination.
The problem is when a user edits a row of a list which is not in the first page of data-table, after completing his action, page navigation returns to the first initial page of the list while we need to return to the previous page that user has been editing.
A complete Scenario:
In the list page there are 100 rows of records, and each page shows 20 rows,
User navigates to the 3th page, and selects one of the rows in order to edit the record.
Backing ListBean calls the EditBean that navigate the page to edit page.
User update the record information and backing Editbean calls back the ListBean.
ListBean refresh the Datamodel and navigate back to the list page, but the state of the pagination that user initially had edited is lost.
What is the best approach to return back the page to the previous page that user has been editing?
Myface 1.2.7 and Tomahawk taglib 1.0 has been used in the project. Pages consist of t:dataTable.
Thanks.
Related
I have a page hierarchy as shown below where everything starts with showing items in a primefaces datatable. For each item a <p:link> or <p:commandlink> is generated.
Click on an item's link should do a redirect to the editItem page with the item's id shown in the query string.
The edit page has a save and cancel button which should redirect back to the listItems page.
The edit page has also a list of subItems, which are shown the same way as in the itemList.
Click on a subItem's link should do a redirect to the editSubSubItem page with the item's id shown in the query string and click on save/cancel should redirect back to the origin editItem page.
Same behavior should be possible for the edit pages editSubItem, editSubSubItem, and so on... Means save/cancel should always redirect back one level in the hierarchy.
http://localhost:8080/myWebApp/listItems.xhtml
http://localhost:8080/myWebApp/editItem&id=123
-> save/cancel - back to listItems
http://localhost:8080/myWebApp/editSubItem&id=456
-> save/cancel - back to editItem&id=123
http://localhost:8080/myWebApp/editSubSubItem&id=789
-> save/cancel - back to editSubItem&id=456
Is there an easy way to achive this kind of hierarchical navigation?
I'am using Primefaces 6.0 and JSF-2.2 on Wildfly-10.0.0.Final
I fixed it by using a Stack<String> object in the SessionMap, where i push the current page url before redirect to another page and pop the origin page on close of the page.
I have a data table on my xPage that shows e.g. 10 rows (repeat limit, rows="10").
How do I know what's the current page number when I navigate through the records by using pager?
After switching between pages I'd like to return back and open dataTable exactly on same page I left:
getComponent("dataTable1").gotoPage(<page number I save>)
I think the best route to get the behavior you want is to use the <xe:pagerSaveState/> control from the ExtLib, which does the job of storing the state of a given pager and restoring it when you go back to the page. Brad Balassaitis has an example of how to use it here: http://xcellerant.net/2013/08/08/xpages-data-views-6-pager-save-state-control/
I have a primefaces datatable which has a list of values being displayed. And every row has a Open button which navigates to other page for details and on the same page i have a back button which takes me page to the previous visited page. so it comes to the datatable page which gets refreshed to the original state...it does not maintain the records which the user had searched. My Managed Bean is in viewscope. I want to the records to be maintained even if the user navigates to other pages and comes back to the same page. I tried making the managed bean Session scoped that solves the issue but on page refresh the datatable does not get refreshed .even if we do a Control+refresh it still maintains the same records
I have two pages, one page has a command button (page 1)with a backed action event that update the database. The other page has a data table that display the value of that database.(page 2)
When I trigger that command on page 1 and navigate to page two the data table is not updating. I am using primeface (jsf) and ejb.
So I was wondering if Requestcontext.update(":page2:datatable") will update the data table on page two or is there a better way of updating the datatable.
Im having a question regarding retrieving the view state of a JSF page.
I have an application in which the user is able to search for persons in a
list and when the user press "show" button the same JSF page will be filled
with a list of the various persons.
Now when I choose one of the persons , another JSF page will show up with more
in-depth and detailed information about that person. Now in that page there is a
"cancel/abort" button displayed. What I want to accomplish is that when I press
that specific "cancel/abort" button the page should be redirected and navigate
back to the JSF page with the list as it was shown, so in some way the "view state"
should be stored (I assume only) but I dont know how it could be done...
I just wanted to check if anyone has been able to solve this kind of issue
in some manner.. ? (The JSF search page as mentioned above is declared as a viewscoped as
an additional information)
Thanks for all help..
You could make the bean #SessionScoped. That means that only one instance will be created by browser session, so when you get back you get the last state.
Of course, session scoped means that when you get back to the view even if it is not a "back" navigation, that info will still be there.