views:

43

answers:

2

Hello,

I would like to edit the rows of my jqGrid in a new page. I have setup a custom function for the edit button with the use of the parameter "editfunc".

How can I redirect the user to that page within the javascript function?

I am using asp.net MVC 2.

+1  A: 

window.location = 'someurl'

or

window.open(..)

Gregg
can I do a redirect using jquery?
Lorenzo
What would be the point of using jQuery to do what window.location already does?
Gregg
I am evaaluating to just update a portion of the page
Lorenzo
I'm not sure what one has to do with the other. The answer to your question is to use a window.location or a window.open(). If this doesn't fullfil your design goals, please update your question with that information.
Gregg
+1  A: 

JS:

var w = window.open("newPage.aspx");

Rather than a new page, I'd recommend a modal window (There are many examples using JQuery, just Google JQuery modal window).

http://ericdotnet.wordpress.com/2009/05/02/editing-in-jqgrid-with-aspnet-mvc/

Has a walkthrough of this already if you want to give it a look.

Ryan Ternier
I already have a solution built on using custom modal dialogs. Anyway the object I would like to edit in this case is fairly complex and need to open other modal dialogs. And there are known issues with nested modal in jquery I cant get rid of...
Lorenzo
I use nested modal dialogs at times, but I generally have a rule of only allowed 2 dialogs displayed at any given time. From a UXP standpoint, it just gets confusing for the user.
Gregg
Rather than multiple modal's, is it possible to allow that data to be shown on the screen? Ie, this commend field. SO could've allowed the Add comment to pop up a modal to enter a comment, but putting this textbox here to edit in works just the same.
Ryan Ternier
@Gregg: I agree with you. In the page I am working on I have at maximum two layer of nested modals (page -> modal -> modal). The main problem that I have is that the overlay bind to key press event so if you have the second modal open and press the ESC key you will see the first modal closing. Please see the bug #3539 on the jQuery UI web site for further information
Lorenzo
@Ryan Ternier: Not in my case. I am referring to a complex object with many properties to modify in edit mode and some collections of related object (with their CRUD operations) to show in a form within a tab
Lorenzo
@Gregg: here is the bug I am talking about `http://dev.jqueryui.com/ticket/3539`
Lorenzo
@Lorenzo Have you considered inline editing in a grid for your child collections? There are many UI alternatives to modal windows. It took me a long time to realize that but I've since found that my software is much more usable w/o all the popups.
Ryan
@Lorenzo Here's a good answer along the lines of what I'm talking about. http://stackoverflow.com/questions/3885648/how-can-i-recreate-a-spreadsheet-or-sharepoint-datasheet-view-on-a-website/3903070#3903070
Ryan
@Ryan: Thanks for the reference Ryan. The answer is yes, I have evaluated other forms of editing for the related collections. For instance I am not using jqGrid to represents these related collection but instead just simple tables with paging rendered with the help of the MVCContrib grid. I have made the question to eventually remove the first modal dialog that contains the complex object and its referenced data.
Lorenzo