user1470589
user1470589

Reputation: 17

display a jqgrid on click of a row on a jqgrid

This page has to be writen in JSP and java

I want to display a jqgrid when i click a row on the jqgrid. Two ideas,

In the first page, i have to display a list in a jqgrid and when the user click a row on the grid

1) the page should be faded and another grid has to be pop up showing the details on another grid. on click of cancel, the pop up grid has to be closed and the background grid has to be visible. 2) another jqgrid should be displayed on top of the actual jqgrid right below the row clicked. Just like a context menu on right click of a jqgrid row.

Please guide me. I am new to jquery and jqgrid and find hard to achieve this.

Upvotes: 0

Views: 1464

Answers (1)

Piyush Sardana
Piyush Sardana

Reputation: 1758

so this is how it is going to work...

onSelectRow:function(id){

var data=jQuery("#gridFirstGrid").jqGrid('getRowData',id); //suppose you have name and company in first grid

var name=data.Name; var company=data.Company;

//there is another way(getCell) also to directly get Name and Company based on id

jQuery("#gridFirstGrid").fadeOut("slow").

load second grid here with the data you want to pick...suppose if you want to get some data from database based on Name or company, send an ajax request from here and return the data in json format and bind it to second grid the same way you were doing in first grid. Implement a custom button in second grid and on the click of the button(cancel) fadeOut the second grid and fade in the first one.

to know how to send ajax request check this link OnClickButton function parameter for MultiSelect jqgrid MVC3, and how to add a custom button check this http://trirand.net/examples/grid/selection/selectedrow_client/default.aspx it is outside the grid, but you can use that also

Upvotes: 2

Related Questions