Forum
05:19
13/11/2009
I just started using jqgrid 3.6.1. all my Json and everything is fine. my jqgrid comes up with no data. I even created the JSON manually and didn't solve the issue. I used the same code with version 3.4 and worked just fine. I am using MVC 2. Below is my code for the page. Any help will be appreciated.
<script type="text/javascript">
jQuery(document).ready(function() {
GridMyFirstGrid.setupGrid($("#list"), $("#pager"), $("#noSearch"));
});
GridMyFirstGrid = {
setupGrid: function(grid, pager, search) {
grid.jqGrid({
url: '/DashBoard/GetUserItems/',
datatype: 'json',
mtype: 'GET',
colNames: ['ItemId', 'Name', 'Price', 'SKU', 'Amount Saved', 'Ready To Buy Code'],
colModel: [
{ name: 'ItemId', index: 'ItemId', hidden: true },
{ name: 'Name', index: 'Name', editable: true, width: 100 },
{ name: 'Price', index: 'Price', editable: true, width: 460 },
{ name: 'SKU', index: 'SKU', editable: true, width: 100 },
{ name: 'AmountSaved', index: 'AmountSaved', editable: true, width: 200 },
{ name: 'ReadyToBuyCode', index: 'ReadyToBuyCode', hidden: true }
],
pager: pager,
jsonReader: {
root: "Rows",
page: "Page",
total: "Total",
records: "Records",
userdata: "UserData",
id: "ItemId"
},
rowNum: 10,
rowList: [5, 10, 20, 50],
sortorder: "desc",
viewrecords: true,
imgpath: '../../Scripts/themes/coffee/images',
caption: 'My first grid'
});
}
};
</script>
<table id="list" class="scroll" cellpadding="0" cellspacing="0"></table>
<div id="pager" class="scroll" style="text-align:center;"></div>
12:58
Moderators
30/10/2007
Hello,
How look you response?
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
16:50
13/11/2009
tony said:
Hello,
How look you response?
Best Regards
Tony
Tony
I have found the reason in a post here
/blog/?page_id=393/help/data-not-showing-c-asp-net-mvc/
This is an MVC 2 issues. Quote from the post
"I actually figured out what the problem was. I am using MVC2, with that I needed to add the following to my controller return statement
JsonRequestBehavior.AllowGet
so the return now looks like:
return Json(jsondata,JsonRequestBehavior.AllowGet); "
Thank you
Most Users Ever Online: 715
Currently Online:
45 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