Load local JSON data in jQgrid

$(document).ready(function () {
    'use strict';
    var data = {
            "page": "1",
            "records": "3",
            "rows": [
                { "id": "NY001", Name: "Jijo", "Email": "vg@gmail.com" },
                { "id": "NY001", Name: "Raj", "Email": "raj@gmail.com" },
                { "id": "NY003", Name: "Ginsha", "Email": "gin@gmail.com" }
            ]
        },
        grid = $("#grdEmail");

    grid.jqGrid({
        colModel: [
            { name: 'Name', index: 'Name', width: "110" },
            { name: 'Email', index: 'Email', width: "300" }
        ],
        pager: '#grdEmail',
        datatype: "jsonstring",
        datastr: data,
        jsonReader: { repeatitems: false },
        rowNum: 2,
        viewrecords: true,
        caption: "Packages",
        height: "auto",
        ignoreCase: true
    });
});

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s