JqGrid for the first time trying to get data using JSON, not working for me

I am 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 it all, I get a client code break in jquery-1.5.2.js (Microsoft JScript runtime error: the object does not support this property or method), where I can not do anything about it, this is probably not used but the error below stops in the last 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 there be something simple to make this crash on me, any ideas?

+4
source share

Source: https://habr.com/ru/post/1347714/


All Articles