Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
Showing Data with jqgrid 3.6.1 and MVC
06/04/2010
05:19
Avatar
mhoque
Member
Members
Forum Posts: 5
Member Since:
13/11/2009
sp_UserOfflineSmall Offline

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>

08/04/2010
12:58
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

08/04/2010
16:50
Avatar
mhoque
Member
Members
Forum Posts: 5
Member Since:
13/11/2009
sp_UserOfflineSmall Offline

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

 

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
43 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information