Sorry to be posting this question. :( But I have spent almost the entire day and need another pair of eyes to look into my code.
OS: Windows Frameworks开发者_开发百科: JQuery (latest version), JqGrid (latest version), Spring (latest version) DB: PostgreSql Tool: Springsource Tools Suite
When I type the below URL, I get XML data back from the server. http://localhost:8080/myapp/deliveryJqgridData
But the below jqGrid call does not call the above URL. I dont get any error on Spring TC server. I do get the alert message "enteredJqgrid". The code below is stored in deliveryJqgrid.jsp. The same is accessed through localhost:8080/myapp/deliveryJqgrid. I have scrambled the column names given below.
<script type="text/javascript">
$(function(){
alert("enteredJqgrid");
$("#deliveryJqgrid").jqGrid({
url:'deliveryJqgridData',
datatype: 'xml',
mtype: 'GET',
colNames:['1Col','2Col', '3Col','4Col','5Col','6Col'],
colModel :[
{name:'1Col', index:'1Col', width:55},
{name:'2Col', index:'2Col', width:90},
{name:'3Col', index:'3Col', width:80, align:'left'},
{name:'4Col', index:'4Col', width:80, align:'left'},
{name:'5Col', index:'5Col', width:80, align:'left'},
{name:'6Col', index:'6Col', width:150, sortable:false}
],
pager: '#deliveryJqgridPager',
rowNum:10,
rowList:[10,20,30],
sortname: '1Col',
sortorder: 'asc',
viewrecords: true,
caption: 'Delivery List - JQ Grid'
});
});
</script>
I have the below div tags in body section.
<table id="deliveryJqgrid"></table>
<div id="deliveryJqgridPager"></div>
Thanks for your help in advance. Update
I found the following error on Firebug. Does this give any clue?
b.jgrid.format is not a function
[Break On This Error] m+"'>"+b.jgrid.format(a.p.pgtext||"","... class='ui-separator'></span></td>"+
I found the problem. I was loading /jquery.jqGrid.min.js before i18n/grid.locale-en.js in my script tag. I reversed the order and it worked!
Thanks to everyone for their patience in helping me through this silly mistake :)
try with
$("#deliveryJqgrid").jqGrid({
url: '/myapp/deliveryJqgridData',
...
});
EDIT:
Used your code in one of my pages and is correctly invoking the server script. I get 404 because I dont have it as you can see
精彩评论