Forum


15:52

03/02/2011

Hello:
I am trying to get a master/detail form to work with Spring MVC. Below is my code. In Firefox, I use Firebug to step through the javascript code. The master table loads fine. I also see my breakpoint hit when I select a row in the master table. In the onSelectRow event, I see the line:
jq("#detailgrid").jqGrid('setGridParam',{url:'/spring-jqgrid-integration/krams/crud/edit?ids=' + ids}).trigger('reloadGrid');
being hit. I know the URL may look odd, but I already tried '/spring-jqgrid-integration/krams/crud/edit' and changed mtype to 'POST', but that did not work either. By not working, I mean simply that the server side doesn't even get called....this is my first problem. Note that in my code, I removed all the paging stuff. Is it possible that this is causing my problem?
Do you have any insight as to why the server side is not being called?
Dan
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" media="screen" href="/spring-jqgrid-integration/resources/css/jquery/ui-lightness/jquery-ui-1.8.6.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/spring-jqgrid-integration/resources/css/jqgrid/ui.jqgrid.css" />
<script type="text/javascript" src="/spring-jqgrid-integration/resources/js/jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
var jq = jQuery.noConflict();
</script>
<script type="text/javascript" src="/spring-jqgrid-integration/resources/js/jquery/jquery-ui-1.8.6.custom.min.js"></script>
<script type="text/javascript" src="/spring-jqgrid-integration/resources/js/jqgrid/grid.locale-en.js" ></script>
<script type="text/javascript" src="/spring-jqgrid-integration/resources/js/jqgrid/jquery.jqGrid.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>JqGrid - Spring 3 MVC Integration Tutorial</title>
</head>
<body >
<script type="text/javascript">
jq(function() {
jq("#headergrid").jqGrid({
url:'/spring-jqgrid-integration/krams/crud',
datatype: 'json',
colNames:['Id', 'First Name', 'Last Name'],
colModel:[
{name:'id',index:'id', width:55,editable:false,editoptions:{readonly:true,size:10},hidden:true},
{name:'firstName',index:'lastName', width:100,editable:true, editrules:{required:true}, editoptions:{size:10}},
{name:'lastName',index:'firstName', width:100,editable:true, editrules:{required:true}, editoptions:{size:10}}
],
rowNum:20,
rowList:[20,40,60],
height: 200,
autowidth: true,
rownumbers: true,
sortname: 'id',
viewrecords: true,
multiselect: false,
sortorder: "asc",
caption:"Users",
emptyrecords: "Empty records",
loadonce: false,
jsonReader : {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
cell: "cell",
id: "id"
},
onSelectRow: function(ids) {
if(ids == null) {
ids=0;
if(jq("#detailgrid").jqGrid('getGridParam','records') > 0 )
{
jq("#detailgrid").jqGrid('setGridParam',{url:'/spring-jqgrid-integration/krams/crud/edit?ids=' + ids}).trigger('reloadGrid');
jq("#detailgrid").jqGrid('setCaption',"Invoice Detail: "+ids);
}
} else {
jq("#detailgrid").jqGrid('setGridParam',{url:'/spring-jqgrid-integration/krams/crud/edit?ids=' + ids}).trigger('reloadGrid');
jq("#detailgrid").jqGrid('setCaption',"Invoice Detail: "+ids);
}
}
});
jq("#detailgrid").jqGrid({
height: 100,
url:'/spring-jqgrid-integration/krams/crud/edit',
mtype: 'GET',
datatype: 'json',
colNames:['Id', 'First Name', 'Last Name'],
colModel:[
{name:'id',index:'id', width:55,editable:false,editoptions:{readonly:true,size:10},hidden:true},
{name:'firstName',index:'lastName', width:100,editable:true, editrules:{required:true}, editoptions:{size:10}},
{name:'lastName',index:'firstName', width:100,editable:true, editrules:{required:true}, editoptions:{size:10}}
],
rowNum:20,
rowList:[20,40,60],
height: 200,
autowidth: true,
rownumbers: true,
sortname: 'id',
viewrecords: true,
multiselect: false,
sortorder: "asc",
caption:"Users",
emptyrecords: "Empty records",
loadonce: false,
jsonReader : {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
cell: "cell",
id: "id"
},
caption:"Invoice Detail"
});
});
</script>
<p>JqGrid - Spring 3 MVC Integration Tutorial</p>
<div id="jqgrid">
<table id="headergrid"></table>
<table id="detailgrid"></table>
</div>
</body>
</html>
Most Users Ever Online: 715
Currently Online:
85 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66