jQuery laden von Daten in jqGrid

Ich bin eine erste Zeit Benutzer von jqGrid, so weit ich ging durch offizielle Beispiele, ich bin daran interessiert, das laden von Daten in grid-entweder mithilfe von json.

Ich bin momentan auf der Suche, das Laden von Daten(JSON-Daten):
http://trirand.com/blog/jqgrid/jqgrid.html

Hier ist ein wenig javascript erstellt grid :

jQuery("#list2").jqGrid(
    {
        url : '<c:url value="${webappRoot}/getdetails" />',
        datatype : "json",
        colNames : [ 'id', 'Location', 'Country Code', 'Type', 'Interval',
                     'Version', 'Last Active', 'Last Login', 'NOTE' ],
        colModel : [
            { name : 'id', width : 10 },
            { name : 'location', width : 75 },
            { name : 'countryCode', width : 50 },
            { name : 'type', width : 40 },
            { name : 'interval', width : 30 },
            { name : 'version', width : 45 },
            { name : 'lastactive', width : 50, align : "right" },
            { name : 'lastlogin', width : 50, sortable : false },
            { name : 'note', width : 50, sortable : false}
        ],
        rowNum : 10,
        rowList : [ 10, 20, 30 ],
        pager : '#pager2',
        width: gridWidth,
        sortname : 'id',
        viewrecords : true,
        sortorder : "desc",
        caption : "JSON Example"
});
jQuery("#list2").jqGrid('navGrid', '#pager2',
                        { edit : false, add : false, del : false});

${webappRoot}/getdetails verwandelt Pfad zu meinem Projekt wie http://localhost/myProject/getdetails ich bin mit spring MVC(könnte relevant sein).

Wenn ich mir in firebug das erzeugt diese http-Anforderung :

GET http://localhost/newProject/getdetails?_search=false&nd=1304638787511&rows=10&page=1&sidx=id&sord=desc  
200 OK
135ms

Hier ist die Antwort :

{
    "id": 1,
    "location": "office_2782",
    "countryCode": "UK",
    "quarter": "500",
    "version": "v3.05",
    "lastactive": "yesterday",
    "lastlogin": "today",
    "note": "no note",
    "type": "read-only"
}

Wenn ich navigieren Sie zur Registerkarte "JSON" es scheint alles gleich wie dieser, keine Ahnung, was ich falsch mache?

Ich versuche zu laden, nur einen Datensatz für den start, und ich nicht bekommen kann es arbeiten, jede Hilfe ist appriciated.

InformationsquelleAutor London | 2011-05-05
Schreibe einen Kommentar