Return to Snippet

Revision: 52812
at November 1, 2011 23:46 by rodrigojuarez


Initial Code
$("#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;
            }

Initial URL

                                

Initial Description

                                

Initial Title
Definicion de grid con carga local de datos

Initial Tags

                                

Initial Language
jQuery