Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
70 lines (59 sloc) 2.42 KB
<meta name="layout" content="main">
<r:require modules="easygrid-jqgrid-dev,export"/>
<body id="overview">
<h2>Owners and pets:</h2>
<b>Click on any owner to see the pets in the grid below. And click on a pet to see the vet visits.</b>
You can filter using the operators in the toolbar or play with the multi-clause filtering
Source code:
<a href="">Controller</a>
<a href="">GSP</a>
<grid:grid name="owners" addUrl="${g.createLink(controller: 'owner', action: 'add')}">
<grid:set caption="Owners" width="800"/>
<grid:set col="id" formatter="f:customShowFormat" />
<grid:set col="nrPets" width="60" />
<grid:exportButton name="owners"/>
<grid:grid name="pets" masterGrid="owners" childParamName="ownerId" addFunction="addPet">
<grid:set caption="Pets" width="600" height="140"/>
<grid:set col="nrVisits" width="60" />
<grid:exportButton name="pets" formats="['excel', 'csv']"/>
<grid:grid name="visits" masterGrid="pets" childParamName="petId" addFunction="addVisit">
<grid:set caption="Visits" width="800"/>
<grid:exportButton name="visits" formats="['excel', 'csv']"/>
function addPet(){
addElement("${g.createLink(controller: 'pet', action: 'add')}", 'owners','', 'owner');
function addVisit(){
addElement("${g.createLink(controller: 'pet', action: 'addVisit')}", 'pets', 'id', 'pet');
function addElement(lnk, gridId, param, master){
var elem = jQuery('#'+gridId+'_table').jqGrid('getGridParam', 'selrow');
alert("You have to select a "+master+" first");
document.location = lnk+"?"+param+"="+elem;;
function customShowFormat(cellvalue, options, rowObject) {
return "<a href='${g.createLink(controller: "owner", action: "show")}/" + cellvalue + "'>" + cellvalue + "</a> ";
console.log(jQuery('#owners_table').jqGridMethod('setSelection', 1));