Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4623896
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:03:12+00:00 2026-05-22T03:03:12+00:00

Here’s the JSON: { page: 1, total: 1, records: 2, rows: [ { Id:

  • 0

Here’s the JSON:

{
    "page": "1",
    "total": "1",
    "records": "2",
    "rows": [
        {
            "Id": 3,
            "FirstName": "Test",
            "LastName": "Testerson",
            "CustomerNumber": "1234",
            "EmailAddress": "test@test.com",
            "Subject": "Test1",
            "OrderNumber": "4321",
            "Comments": "This is a test"
        },
        {
            "Id": 4,
            "FirstName": "Test2",
            "LastName": "Testerson2",
            "CustomerNumber": "2222",
            "EmailAddress": "test@test.com",
            "Subject": "Test1",
            "OrderNumber": "3333",
            "Comments": "This is a test"
        }
    ]
}

Here’s my current script and markup (why isn’t this working?):

<table id="list1"></table>
<div id="pager1"></div>
<script type="text/javascript">
    function getData(pdata) {
        var params = new Object();
        params.page = pdata.page;
        params.pageSize = pdata.rows;
        params.sortIndex = pdata.sidx;
        params.sortDirection = pdata.sord;


        $.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            url: "ScriptServices/PNScriptService.asmx/GetContactRequests",
            data: JSON.stringify(params),
            dataType: "json",
            success: function (data, textStatus) {
                if (textStatus == "success") {
                    var thegrid = $("#list1")[0];
                    thegrid.addJSONData(data.d);
                }
            },
            error: function (data, textStatus) {
                alert('An error has occured retrieving the data.');
            }
        });
    }

    $(document).ready(function () {
        $("#list1").jqGrid({
            datatype: function (pdata) {
                getData(pdata);
            },
            jsonReader: {
                page: "page",
                total: "total",
                records: "records",
                root: "rows",
                id: "Id",
                repeatitems: false
            },
            colNames: ['Id', 'FirstName', 'LastName', 'CustomerNumber', 'EmailAddress', 'Subject', 'OrderNumber', 'Comments'],
            colModel: [
                { name: 'Id', index: 'Id', width: 90 },
                { name: 'FirstName', index: 'FirstName', width: 100 },
                { name: 'LastName', index: 'LastName', width: 100 },
                { name: 'CustomerNumber', index: 'CustomerNumber', width: 80, align: "right" },
                { name: 'EmailAddress', index: 'EmailAddress', width: 100 },
                { name: 'Subject', index: 'Subject', width: 80 },
                { name: 'OrderNumber', index: 'OrderNumber', width: 80, align: "right" },
                { name: 'Comments', index: 'Comments', width: 250, sortable: false }
            ],
            rowNum: 10,
            rowList: [10, 20, 30],
            pager: $('#pager1'),
            sortname: 'Id',
            viewrecords: true, 
            sortorder: "desc",
            caption: "Contact Requests"
        });
    });
</script>

btw: The JSON string above is the exact string returned by the script service. I can hit a break point in my script service and grab that string, and I can alert the string in the calling ajax script on success, and the strings are identical. So I know it’s not the script service, and I know that that json string is being passed, as shown, into the jqGrid.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:03:13+00:00Added an answer on May 22, 2026 at 3:03 am

    Thanks Oleg for the info, but it turned out to be the following:

    thegrid.addJSONData(JSON.parse(data.d));
    

    I needed to JSON.parse the data before passing it into the grid.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here total two union binding three queries, first query retrieving records from a virtual
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Here is a link my example of the misaligned table rows Click preview in
Here's the top of my usercontrol: <UserControl x:Class=MyApp.Common.Controls.Views.SimpleView xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006 xmlns:d=http://schemas.microsoft.com/expression/blend/2008 xmlns:Framework=http://www.memoryexpress.com/UIFramework mc:Ignorable=d
Here's my test function (c#, visual studio 2010): [TestMethod()] public void TestGetRelevantWeeks() { List<sbyte>
Here is an excerpt from Mixed Effects Models in S and S-Plus page 238
here is the code : http://jsfiddle.net/yuliantoadi/hMr7h/ if you try to hover the 'test 2'
Here's the page in question: http://bit.ly/m5cyjx There's hardly any code or styling. It seems
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here's a problem I ran into recently. I have attributes strings of the form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.