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_TopicIcon
Help with Jqgrid and Asp.Net MVC 2
11/05/2010
20:14
Avatar
maitopoika
Member
Members
Forum Posts: 17
Member Since:
16/03/2010
sp_UserOfflineSmall Offline

When I load the page the grid just says loading, and that never goes away. I can put a break point in my controller that the gird is bound to, and it does hit the controller and I can step through the controller getting all the correct data I would expect and goes through the return statement.
But the grid never shows the data and the loading graphic never goes away.
Any Ideas?
here is my grid

<script type="text/javascript">
 
    jQuery("#OpenPOList").jqGrid({

       url:'PurchasingReceiving/JsonOpenPO',
       datatype: 'json',
       mtype: 'GET',
       altRows: 'true',
       colNames: ['POnum','OrderDate','Company','ChangeBy'],
       colModel: [
                         { name: 'POnum', index: 'POnum', width: 200, align: 'left' },       
                         { name: 'OrderDate', index: 'OrderDate', width: 200, align: 'left' },   
                         { name: 'Company', index: 'Company', width: 200, align: 'left' },       
                          { name: 'ChangeBy', index: 'ChangeBy', width: 200, align: 'left' },                          
                           ],
       pager: jQuery('#OpenPOPager'),
       rowNum: 20,
       rowList: [5, 10, 20, 50],
       sortname: 'Id',
       sortorder: "desc",
       viewrecords: true,
       height: '200px'
    
   }); //end jQuery("#ScheduledL
</script>
 

And here is the controller

 public ActionResult JsonOpenPO(string sidx, string sord, int page, int rows)
        {
             
            PurchaseOrderService srv = new PurchaseOrderService();
            List<PurchaseOrder> context = new List<PurchaseOrder>();
            try
            {
                context = srv.GetOpenPurchaseOrders();
            }
            catch (Exception ex)
            {
                string x = ex.Message;
                log.Error(ex.Message, ex);
                

            }

            int pageIndex = Convert.ToInt32(page) - 1;
            int pagesize = rows;
            int totalrecords = context.Count();
            int totalPages = (int)Math.Ceiling((float)totalrecords / (float)pagesize);
            string orderBy = string.Format("{0} {1}", sidx, sord);
            var POs = context.AsQueryable()
                            .OrderBy(orderBy)
                            .Skip(pageIndex * pagesize)
                            .Take(pagesize);

            //format data for the grid
            var jsondata = new
            {
                total = totalPages,
                page = page,
                records = totalrecords,
                rows = (from s in POs
                        select new
                        {
                            cell = new string[]{
                                s.POnum,
                                s.OrderDate.ToShortDateString(),
                                s.Company,
                                s.ChangeBy
                             }
                        }).ToArray()
            };

            return Json(jsondata, JsonRequestBehavior.AllowGet);
        }

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
70 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