/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$("#obraSocialTable").jqGrid({ datatype: "local", autowidth: true, scrollOffset: 0, shrinkToFit: true, height: 'auto', colNames: ['Codigo', 'Descripcion', '', 'Id'], colModel: [ { name: 'Codigo', width: 15, align: "right", sortable: false }, { name: 'Descripcion', width: 80, align: "left", sortable: false }, { name: 'acciones', width: 5, align: "center", sortable: false }, { name: 'Id', hidden: true } ], caption: "Obras Sociales" }); function cargarObrasSociales() { $("#obraSocialTable").jqGrid('clearGridData'); var data = obtenerObrasSociales(); $.each(data, function (index, value) { $("#obraSocialTable").jqGrid('addRowData', value.Id, value); agregarBotonesGrid(value.Id); }); }; function obtenerObrasSociales() { var obrasSociales; $.ajax({ type: 'POST', async: false, url: '@Url.Action("ObtenerObrasSocialesParaEdicion", "ObraSocial")', dataType: "json", contentType: "application/json; charset=utf-8", success: function (data) { obrasSociales = data; }, error: function (jqXhr) { $("#errorDialog") .html(jqXhr.responseText) .dialog('open'); } }); return obrasSociales; }