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 is my persistence.xml : <?xml version=1.0 encoding=UTF-8?> <persistence xmlns=http://java.sun.com/xml/ns/persistence xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd version=1.0>
here is my configuration: http://domain.com (obviously fictitious name...) hosted on a server running Apache
Here's my Manifest: <?xml version=1.0 encoding=utf-8?> <manifest xmlns:android=http://schemas.android.com/apk/res/android package=com.mappp.mobile android:versionCode=1 android:versionName=1.0 > <supports-screens android:largeScreens=true
Here is my code (Say we have a single button on the page that
Here's my test function (c#, visual studio 2010): [TestMethod()] public void TestGetRelevantWeeks() { List<sbyte>
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Here's the problem....I have three components...A Page that contains a User Control and a
Here is my problem...I have a page that loads a list of clients and
Here my code: $(document).ready(function() { $('#mid_select').live('click', function(e){ $('#middle').load( $(this).attr('href') + ' #middle'); var page
Here's a basic regex technique that I've never managed to remember. Let's say I'm

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.