jqgrid - any event before a page unloads - jqgrid

Does jqGrid have any event before a current page unloads?
I have virtual paging turned on and when you are between 2 pages e.g page 1 and page 2, I want to trigger something when page 2 loads.

You can use the loadComplete event to capture when page 2 loads, which seems like it should be good enough.

Related

jqGrid resize event and the event triggered when page is refreshed

I have a jqGrid in my page and I want to know when does the resize event occur. Will it occur when I refresh the page? If not, what event occurs when the page containing the grid is refreshed. I would like to capture the event to alter it's width when the page is refreshed.
A page refresh causes a postback, so jQuery/jqGrid events aren't really going to detect a refresh so much as the page loading.
Depending on your goals, I would suggest either the jQuery .ready() method or the jqGrid gridComplete() method to handle grid resizing any time someone opens or refreshes the page.
Which one you use will likely depend on whether the actual data that the grid receives is going to influence how large you want to set the grid.
If the data doesn't matter and you just are concerned about the size of the browser window, I would use .ready() and pre-populate your grid configuration with the appropriate size.
If the data does matter, you'll probably want to use the gridComplete method on your jqGrid.
If you want to be able to adapt your grid size when the user resizes the browser, see this answer: Resize jqGrid when browser is resized?

Partial refresh of JSF page using ui:repeat and AJAX

I have a page say "Main Page" (Page 1) which looks like a Outlook calendar page having a large number of rows displayed using . Actually, the columns represent "Weeks" and the rows represent "Products". The functionality is that the user can choose a product week combination and create offers for the chosen week.Ideally, as we have a lot of rows (products), we should have ideally implemented pagination but we have not.
We use JSF2 (Mojarra faces that comes with JBoss EAP 6.0). Main Page uses a different bean and Details page uses a different bean and both are in session scope.
When the user creates an offer, instead of refreshing the entire page (i.e. Page1), we just refresh the impacted cells using AJAX. However, the On double clicking the slot(offer), we redirect to a different page (Page2) that displays offer details.
Page 1 - Main Page and Page 2 - Details page.
There are 2 cases from here :
Case 1: User goes from Main page to the details page, just views information on the details page and clicks the close button. In this case, it is enough for me to display Main Page as it was before I opened the details page. To achieve this, we used browser history.back(). However, we faced the below issues :
(a) history.back() works only in Firefox and does not work in Chrome/IE.
(b) Even if we do history.back(), the page loading is cleary visible and as our page is heavy, it takes a few seconds. I would like to avoid re-rendering of main page again (i.e. make it look like opening a popup from the main page and closing it)
Case 2: User goes from Main Page to Details page and makes certain updates which require us to reflect those updates in the main page.(For example: change color of the slot from red to green on the main page).
Currently, when Details page is closed, we call an API that provides us with refreshed data (so that we do not need to maintain the list of actions that the user had performed) and we reload the entire Main page (Page1). However, as the page takes a long time to load, we are asked to refresh only the affected slots/rows.
So, the problem here is that if we have to achieve the refresh of Main Page through AJAX, we need to maintain a list of activities that has been done on the details page and feed it through AJAX which appears to be a complicated activity. (We also want to avoid calling the API.)
Is there any workaround which helps us to refresh only the selected rows on the Main Page to minimise the page load time. Can ui:repeat be partially re-rendered ?
PLease advise.

JSP Page taking too long to load

I have a JSP Page (this is a tabbed view) with 2 text boxes, 2 dropdowns, checkbox & 4 list boxes.
One dropdown is populated by making connection to db and query through prepared statement.
The 4 listboxes & 2nd dropdown get populated through AJAX if the checkbox is checked. By default the checkbox is unchecked.
The problem here is, the JSP Page takes too long to load. It is approx 0.11 min to load the page.
Even before I check the checkbox and populate the list boxes and the 2nd dropdown, the page loads too slow.
Does being page in tab slow the performance?
Any idea why is this happening and what can I do to improve the page performance?
I found a workaroud for this issue. I am loading the page first and then making AJAX call to load just this dropdowndown control. In that way, user won't feel that the page is loading slowly. I know this is not a permanent solution.

Tombstoning with MVVM and more than one page

Where can I find informatin about tombstononig with more that one page?
I`ve 2 pages every one with his own viewmodel, from page 1 nagite to page 2, If in this page ocurs tombstonig How can save and restore page1´s viewmodel?
Thanks
Save the state of page 1 in OnNavigatedFrom if the phone tombstones or navigates to page 2
Restore the state of page 1 in OnNavigatedTo.
Delete the state of page 1 if the user navigates backwards at page 1.

Server Side Pagination + jQuery Question

I have yet to come across a good tutorial that explains how to load records from a database and spit them out using jQuery Ajax and also display pagination navigation.
Example Page
Apple
Banana
Pear
Grapes
(Pagination Nav)
[First Page] [Prev Page] [5] [6] [7] [Next Page] [Last Page]
In my head I think it works like this.
User loads home page. Home page by
default spits out records with at
the first offset and with a
specified results per page (e.g.
LIMIT 0,10)
Serverside script queries count of
records, extrapolates number of
pages to navigate by using results
per page.
Serverside script echoes a
navigation panel based on current
page.
jQuery listens for click events on
navigation panel, uses get to fetch
the content and sets html of content
container.
I also want the URL of the site to change in case anyone refreshes the page (to obviously display the desired result).
How can this be done?
You might want to try dataTables, a jQuery plugin that covers exactly what your talking about look for server-side procesing

Resources