jQWidgets Forums

jQuery UI Widgets Forums ASP .NET MVC jqxGrid is not exported to excel in asp.net c # WebForms

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 6 years, 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • Novato
    Participant

    Hi, I’m trying to export my jqxGrid to an excel file but it does not download. I hope you can help me. Thank you.

    This is my code and it does not show me any error in console.

    
    function obtener_Personas() {
    
        var persona = $("[id*=ddlPersona]").val();
        var Sucursal = "";
        var id_Rol = 1;
    
        if (intervalo != 0) {
        
            var valores;
       
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "frmPersonas.aspx/Persona",
                contentType: "application/json; charset=utf-8",
                data: '{id_Persona:"' + persona + '",Sucursal:"' + Sucursal + '",id_Rol:"' + id_Rol + '"}',
                async: false,
    
                success: function(data) {
    
                    if (data != '') {
    
                        valores = data.d.split("-");
                        var url_imagen = valores[1];
                        $("#imgProceso").attr("src", url_imagen);
                        valores = JSON.parse(valores[0]);                  
    
                    }
    
                    var gridSource =
                    {
    
                        datatype: "json",
                        localdata: valores,
                        async: false
    
                    };
    
                    var gridDataAdapter = new $.jqx.dataAdapter(gridSource);
    
                    $("#gvDatos").jqxGrid({
                        width: 1030,
                        columnsresize: true,
                        autoheight: true,
                        autorowheight: true,
                        autoheight: true,
                        altrows: true,
                        rowsheight: 35,
                        pageable: true,
                        sortable: true,
                        filterable: true,
                        source: gridDataAdapter,                  
                        columns: 
                        [
                                                                                { text: 'ID', datafield: 'id_Persona', width: 200 },
                                                                                { text: 'Sucursal', datafield: 'Sucursal', width: 200 },
                                                                                { text: 'Estado', datafield: 'Estado', width: 200 },
                                                                                { text: 'Municipio', datafield: 'Municipio', width: 200 },
                                                                                { text: 'Ciudad', datafield: 'Ciudad', width: 200 },
                                                                                { text: 'Nombre', datafield: 'Nombre', width: 200 }
                                                                               
                                                                          ]
                    });
    
                },
    
                error: function(error) {
                    alert(error.responseText);
                    console.log(error.responseText);
                    jsonValue = jQuery.parseJSON(Error.responseText);
                    alert(error.respose.Text);
                    alert("Error");
                }
            });
    
        }
        else {
            alert("Por favor seleccione todos los datos");
        }
    
    }
    
    

    This is my function to download my excel through a variable but it does not download anything and if it shows me the data in console, but I do not download the file (I have added the resources as indicated in your documentation). I do not have developer or company licenses.

    
    var descarga;
    function descargar_Excel() {    
        descarga = $("#gvDatosCompensaciones").jqxGrid('exportdata','xls');       
            console.log(descarga);
    }
    

    Hristo
    Participant

    Hello Novato,

    I tested this example and it seems to work fine.
    Also, I would like to mention that the license does not increase the limit of the exported file.
    Could check is there any error message in the console?

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.