Javascript using window.location seems to lose state
Posted on
16th Feb 2014 07:03 pm by
admin
Not sure what forum so let me know if I'm in the wrong place.
I have a main window with a ajax grid that has a column of links that uses javascript and window.location to go to another page to show check stub information. When I use the backbutton on the browser everything persists on main window. Ok so far.
If I navigate to the window with the show check stub information, there is a 'Print' button that again thru javascripts prints the grid with the check info on it. (Code I got of the internet with some minor changes I made).view plaincopy to clipboardprint?function Print() { var curVisible = true; var grid_obj = document.getElementById('<%= grdVoucherDetail.ClientID %>'); for (var i = 1; i < grid_obj.rows.length-1; i++) { grid_obj.rows[i].cells[8].style.display = curVisible ? "none" : "inline"; grid_obj.rows[i].cells[9].style.display = curVisible ? "none" : "inline"; } if (grid_obj != null) { var new_window = window.open('print.html'); //print.html is just a dummy page with no content in it. new_window.document.write(grid_obj.outerHTML); new_window.document.close(); new_window.focus(); new_window.print(); new_window.close(); } curVisible = false; for (var i = 1; i < grid_obj.rows.length-1; i++) { grid_obj.rows[i].cells[8].style.display = curVisible ? "none" : "inline"; grid_obj.rows[i].cells[9].style.display = curVisible ? "none" : "inline"; } } function Print() {
var curVisible = true;
var grid_obj = document.getElementById('<%= grdVoucherDetail.ClientID %>');
for (var i = 1; i < grid_obj.rows.length-1; i++) {
grid_obj.rows[i].cells[8].style.display = curVisible ? "none" : "inline";
grid_obj.rows[i].cells[9].style.display = curVisible ? "none" : "inline";
}
if (grid_obj != null)
{
var new_window = window.open('print.html'); //print.html is just a dummy page with no content in it.
new_window.document.write(grid_obj.outerHTML);
new_window.document.close();
new_window.focus();
new_window.print();
new_window.close();
}
curVisible = false;
for (var i = 1; i < grid_obj.rows.length-1; i++) {
grid_obj.rows[i].cells[8].style.display = curVisible ? "none" : "inline";
grid_obj.rows[i].cells[9].style.display = curVisible ? "none" : "inline";
}
}
Did you know?Explore Trending and Topic pages for more stories like this.
Now after the print and closing that popup I click the backbutton again and things don't seem to persist.
I did notice that the pageload of the main window (one I'm going back to) gets triggered after the printing of the grid where if I don't click the print button and go back the pageload does not get triggered.
Any ideas would be appreciated. I have searched and searched for an answer and am getting nowhere. When this happens I usually feel that I've done something stupid. Oh well
Thanks for any help that you can give me
No comments posted yet
Your Answer:
Login to answer
87
21
Other forums
single page with referrer to show correct page
I have a simple website with a couple of different pages. I would like to be able to in a div tag w
a dificult string search
Hi I don't know a way around this. I want the user to input a password, but to make it a bit complca
Load file in PHP
I have 2 files. The first is a PHP generated XML file that's dependent by 2 inputs. The second is a
disabling a button server-side then re-enabling client-side breaks button postback
I have a tabbed container and a button (not in the container) on a page. If the first tab is selecte
2 decima places & How to reload my page
Hello There,
How do i put full-stop (.) after second figure from behind? ie if i have 123456
Need Help with a query
Hello,
For some reason I am just not getting the right answer when I do this query and not quite
Placing and array within an array then sorting it!
I have a page that runs two large mysql queries and saves the results into arrays, in php I then per
Material Master Update through BAPI - Follow up material not updated
Hi Experts,
I am updating the material master through a custom transaction using the BAPI
'grab_files', multiple extension?
hey guys,
can anyone suggest a way to make to following line of code look for files with more
Generate multilayered array from string.
ok so i have a string that looks like this:
Code: [Select]blog:edit_all,delete_all|users:edit_all