4

I'm trying to implement a simple grid using jqGrid, my first read example of my own.

Here is my JSON code:

$(document).ready(function() {

    $("#editgrid").jqGrid({
    url: '<%= ResolveUrl("~/User/index") %>',
        datatype: "json",
        myType: 'GET',
        colNames: ['UserId', 'Surname', 'Forename', 'Pax', 'Mobile', 'Active', 'Email'],
        colModel: [
    { name: 'UserId', index: 'UserId', width: 80, editable: true, editoptions: { size: 10} },
    { name: 'Surname', index: 'Surname', width: 90, editable: true, editoptions: { size: 25} },
    { name: 'Forename', index: 'Forename', width: 60, align: "right", editable: true, editoptions: { size: 10} },
    { name: 'Pax', index: 'Pax', width: 60, align: "right", editable: true, editoptions: { size: 10} },
    { name: 'Mobile', index: 'Mobile', width: 60, align: "right", editable: true, editoptions: { size: 10} },
    { name: 'Active', index: 'Active', width: 55, align: 'center', editable: true, edittype: "checkbox", editoptions: { value: "Yes:No"} },
    { name: 'Email', index: 'Email', width: 100, sortable: false, editable: true, edittype: "textarea", editoptions: { rows: "2", cols: "20"} }
],
        rowNum: 10,
        rowList: [10, 20, 30],
        pager: '#pagered',
        sortname: 'Surname',
        viewrecords: true,
        sortorder: "desc",
        caption: "Editing Example",
        editurl: "detail.aspx"
    });
    $("#bedata").click(function() {
        var gr = jQuery("#editgrid").jqGrid('getGridParam', 'selrow');
        if (gr != null) jQuery("#editgrid").jqGrid('editGridRow', gr, { height: 280, reloadAfterSubmit: false });
        else alert("Please Select Row");
    });

});             

I have the following HTML :

<table id="editgrid"></table>
<div id="pagered"></div>
<input type="button" id="bedata" value="Edit Selected" />

But when I run all this I get client code breaking within jquery-1.5.2.js (Microsoft JScript runtime error: Object doesn't support this property or method) where I can do nothing about this, this is probably of no use but here is the error below, stops at the finally part :

            // resolve with given context and args
            resolveWith: function( context, args ) {
                if ( !cancelled && !fired && !firing ) {
                    // make sure args are available (#8421)
                    args = args || [];
                    firing = 1;
                    try {
                        while( callbacks[ 0 ] ) {
                            callbacks.shift().apply( context, args );
                        }
                    }
                    finally {
                        fired = [ context, args ];
                        firing = 0;
                    }
                }
                return this;
            },

Must be something simple making this crash out on me, any ideas anyone?

John
  • 1,459
  • 4
  • 21
  • 45
  • public JsonResult Index() { return Json(new { UserId = 1, Forename = "John", Surname = "Scobie", Mobile = "23232", Email = "sdsdsd", Pax = "sss", Active = true }); } – John Apr 12 '11 at 12:20
  • Are you certain that `'<%= ResolveUrl("~/User/index") %>'` works within that javascript block? In my ignorance, that would be the first thing I try - hard code and see if it fixes it. – Nick.Mc Jan 15 '13 at 10:22

0 Answers0