When a user double clicks on a row on my page, I navigate them to an edit screen which shows them some important information. When they submit that patient I gerimander jqGrid to take them page to the page that they were just viewing...
serializeGridData: function (postData) {
//debugger;
var pagInfo = $(this).se
debugger;
if ((rowFromTemp != "") && (pageFromTemp != "")) {
//debugger;
postData.page = pageFromTemp;
pageFromTemp = "";
rowFromTemp = "";
}
return postData;
},
I basically edited the postData in the serializeGridData function.
My question is, when I navigate to a different page lets say page 3 of 10 after I have edited information and returned to the correct page, when I click refresh of the whole page...
I want the user to return to the page that they just navigated to. Right now, it will return them back to the page that they initially returned from after editing information. So If I were to construct a timeline of events...
1) user see's paged information...
2) user selects row to edit
3) user navigates to edit page and does his thing then submits
4) user now is sent back to page where he came from...
5) user goes to a different page (either next or last)
6) user refreshes page
7) !! user is sent to page X from step 3 and 4 and Not 5 !!
I was hoping to to some kind of refresh of page event and set the correct page in there.
Is my methodology or thinking in correct here? Is there a way to ensure that the correct page is selected no matter what?
I just checked again. It would seem that if a user
1) navigates to page X
3) refreshes a page
he will be sent to page 1.
Maybe I am setting an unrealistic expectation. Maybe if they reload the whole page, they should expect to go back to page 1.
Well even so, how could I accomplish that task with the first workflow
In my opinion the real problem which you have is the usage of step 3: "user navigates to edit page and does his thing then submits". The step makes all the problems which you try to solve. Instead of going to another page one can create dynamically some controls which allows to edit the selected row. jqGrid provide inline editing or form editing for the purpose. You need just include editable: true property in the columns which you need to edit implement starting of inline/form editing on select of row or on double click. Alternatively you can use buttons from the navigator bar (see navGrid and inlineNav) or in addition column of the grid (see formatter: "actions").
If you still don't want to use any editing mode which provide jqGrid you can just place the whole content of the body of the main page inside of a div. You can hide the div using jQuery.hide instead of redirection to "edit page". You can load the content of "edit page" on the same main page (per jQuery.load for example). Then you can remove the loaded "edit page" and show the original main page. As the result the main page will be shown in exactly the same form as it was before starting of editing.
Related
I have a value of a field on page 1 that I need to pass to page 2 (modal dialog).
The field is changed on page 1. and I can see it's got updated on the page and when I print its value in debug messages.
When I'm clicking the button, with the action "Redirect to Page in application", the value on page 2 is the initial value of the field, and not the updated one, is this a bug?
what can I do?
I don't want to use dynamic action or things like "prepare_url" because of many reasons.
Thanks.
That is not how a link works. What you are seeing is not a bug, it is expected behaviour. The link is rendered when the page is rendered and will have the item values at render time and a calculated checksum (depends on settings) based on those values. It will not pick up any changes.
The "traditional" way to do this is the following. Assumptions: Need to navigate from page 1 to page 2 and set P2_ITEM on page 2 to value of P1_ITEM on page 1.
Create button (let's say button name is MYBUTTON) of type "Submit Page"
Under "Processing", create a branch to page 2.
For "Page or URL" pick page 2 and set P2_ITEM to value P1_ITEM.
For "Process point" pick "After Submit"
Under "Server Side Condition", select "MYBUTTON" under "When Button Pressed".
Since this is a branch your page has been submitted and all the changes you made to P1_ITEM will be picked up. The fact that page 2 is modal does not affect this, APEX will take care of that for you.
As an alternative to Koen Lostries excellent explanation, in some cases it is also possible to have the target page load the item from the source page.
Ensure that the item is being pushed to the session, for example by using a dynamic action with the items to submit option, but do nothing else in this dynamic action.
Then, when page 2 opens, simply add a pre-header-process, that makes something like :P2_ITEM := :P1_ITEM;
In my experience this approach is easier than doing a redirect in a dynamic action, as there is no declarative option for that and you often need hand-written javascript to do that.
I have an index page where all the models are shown and when you click edit you go to edit page and after you change something you click update and you will be redirected to index, all fine there.
And now i have made a show view and in show view i made the same edit button to go to edit page and when you click update of course you will be redirected of to the index page and i don't want that. I want to redirect user to the page where the EDIT button was clicked.
How can i redirect users to the page where they actually clicked the edit button?
You can keep URL in session to go two pages back in Laravel:
$links = session->has('links') ? session('links') : []; // Get data from session
array_unshift($links, $_SERVER['REQUEST_URI']); // Add current URI to an array
session(compact('links')); // Save an array to session
Then you can go 2 pages back:
return redirect(session('links')[2]);
You can use:
return back();
It returns you to back as it is so obvious. You can research this and other helper functions here:
https://laravel.com/docs/5.3/helpers#method-back
I have a currently loaded form with different fields in it. Example I am on URL: https://localhost:44300/ where the form is currently displayed. However, once of the fields has a link beside it "View Full List" where in once I click on that it will redirect me to a different view and user can select one value from there.
View full list when clicked will be redirected to: https://localhost:44300/project/organisationfulllist/
Now, once I have selected from the displayed list in that view (radiobutton list), I will click on a [SAVE] button and it should redirect me back to my original form with URL https://localhost:44300/
My question is when I am redirecting to the original view, the previous inputs on several fields were reset. What I want is to preserve these inputs from user. Is there a way to sort of save the session of the previous form?
Save the information in the session once the user clicks "View Full List"
Session["formdata"] = formdata;
Then get it back when you open the form again
FormModel formModel = Session["formdata"] as FormModel;
Is it possible to not redirect when user clicks "View Full List" and keep the selection on the same page? On a pop-up or something.
I want to maintain the Scroll Position between two pages. I have a Page A which has many reports, when user clicks a report, user will be redirected to Page B where the report will be opened to make the changes. After submitting changes, user will be redirected to Page A. Here the problem is, showing the top of the page but I want to show the page at the previous position.
I have tried using this.MaintainScrollPositionOnPostBack = true; but this is working only on the same page but not between the different pages.
I really need to fix this, please give me your thoughts...
The simplest thing to do is probably give every link/report on page A an anchor.
So, for each report you would hide an id attribute somewhere - say the title, so it would be something like <h3 id="report42">Report 42</h3>. Then when you go back from page B, instead of going to www.example.com/pageA.html, you go to www.example.com/pageA.html#report42. This will open the page with the scrollbar at wherever the report42 id is found.
I have a Freemarker template displaying a list of things, now I want to add some pagination.
I have changed the server-side code so that I can put into the backing form the page number (default 1) and page size (default 20) along with a bunch of query parameters. The Controller will handle this correctly and return the list of things, the page number and the last page number in the model.
But what I don't know (as I haven't done much web layer stuff before) is what to do in the template so that the user can click on next/previous/page-3 etc.
The template currently has:
<button type="submit" id="searchButton">Search</button>
I guess I could add buttons for each of the actions, but how could I then detect in the controller which button was clicked?
Cheers
Paul
You could add an onClick event on buttons (or A HREF links) in your template, linked to a bit of Javascript that sets a value for a hidden element in the page. This element (say ACTION) would hold the value of which button you clicked (NEXT or PREVIOUS), so that on the server side, the controller can do the right thing according to the value of ACTION.
form.elements["ACTION"].value = 'NEXT'
Or that could also be a PAGE element, which holds the target number of the page (if you want to allow direct linking to all pages)
So if you're currently on page 4:
form.elements["PAGE"].value = '5' // for the 'NEXT' button
form.elements["PAGE"].value = '3' // for the 'PREVIOUS' button