Note that there are some explanatory texts on larger screens.

plurals
  1. POJqGrid doesn't show the Data
    primarykey
    data
    text
    <p>The problem is this, while developing the application I did several run test, and jqGrid worked really well, ie on the local server everything worked fine, but now I'm testing the application on a server and it no longer works because all grids are empty. I thought it was a problem with the database, but checked the Json string and this is correct. If I put the url: <code>myOrg/Home</code> grid is shown empty, and if I put <code>myOrg/Home/GridData</code> shows the Json format data, correctly ... what is happening ...?? why the data isn't show in the grid..?? locally everything worked like a charm, will I need any additional library in to the server.. or something ..?</p> <p>Please help me.</p> <p>Thanks in advance.</p> <p>EDIT:</p> <p>Here's the javascript I´m using</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { var lastsel; $(function () { jQuery('#list').jqGrid({ url: '@Url.Action("GridData", "Contacto")', editurl: '@Url.Action("EditData", "Contacto")', datatype: 'json', height: 250, colNames: ['Id', 'Nombre', 'Teléfono', 'e-mail', 'Empresa'], colModel: [ { name: 'Id', index: 'Id', width: 50 }, { name: 'Nombre', index: 'Nombre', width: 100, sortable: true, editable: true, edittype: "text", editoptions: { size: "15", maxlength: "20"} }, { name: 'Telf', index: 'Telf', width: 80, editable: true, edittype: "text", editoptions: { size: "10", maxlength: "15"} }, { name: 'Email', index: 'Email', width: 100, editable: true, edittype: "text", editoptions: { size: "15", maxlength: "20"} }, { name: 'Empresas', index: 'Empresas', width: 100, editable: true, edittype: "select", editoptions: { dataUrl: '/Contacto/ListaEmpresas/'} } ], caption: 'Listado de Contactos', onCellSelect: function (rowid, iCol, cellcontent, e) { if (rowid &amp;&amp; rowid !== lastsel) { jQuery('#list').restoreRow(lastsel); lastsel = rowid; } jQuery('#list').editRow(rowid, true, iCol); }, autowidth: true, rowNum: 10, rowList: [10, 20, 30], pager: '#pager', sortname: 'id', sortable: true, loadonce: true, viewrecords: true, sortorder: 'asc' }); jQuery('#list').jqGrid('navGrid', '#pager', { edit: true, add: true, del: true, search: true }, { url: '@Url.Action("EditData", "Contacto")', closeAfterEdit: true }, { url: '@Url.Action("AddData", "Contacto")', closeAfterAdd: true, closeOnEscape: true, width: 500, modal: true, addCaption: 'Añadir nuevo Contacto', reloadAfterSubmit: true, drag: true }, { url: '@Url.Action("DeleteData", "Contacto")', closeAfterDelete: true, deleteCaption: 'Borrar Registro', reloadAfterSubmit: true }, { closeAfterSearch: true, reloadAfterSubmit: true } ); }); }); &lt;/script&gt; </code></pre> <p>And here the server side code that generates the json String:</p> <pre><code>public ActionResult GridData(string sidx, string sord, int? page, int? rows) { List&lt;Contacto&gt; contactos = new List&lt;Contacto&gt;(); contactos = ContactoRepository.GetAll().ToList&lt;Contacto&gt;(); int pageIndex = Convert.ToInt32(page) - 1; int totalrecords = contactos.Count(); //int totalpages = (int)Math.Ceiling((decimal)totalrecords / (decimal)rows); var jsonData = new { sidx = "Id", sord = "asc", //total = totalpages, page = page, records = totalrecords, rows = ( from ct in contactos select new { id = ct.Id, cell = new string[] { ct.Id.ToString(), ct.Nombre, ct.Telf, ct.Empresas.Nombre, } }).ToArray(), }; return Json(jsonData, JsonRequestBehavior.AllowGet); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload