Hi, I've been struggling trying to solve a problem when implementing the Excel export button as shown in the paramquery grid examples. The code I've is the following:
$(function () {
var colModel = [
{ title: "ID Registro", dataIndx: "IdRegistro", width: 100 },
{ title: "Categoria", width: 180, dataIndx: "GlsSiglaCategoria" },
{ title: "Valor", width: 140, dataIndx: "GlsValor" }
];
var dataModel = {
recIndx: "IdRegistro",
location: "remote",
sorting: "local",
dataType: "JSON",
method: "GET",
sortIndx: "GlsSiglaCategoria",
sortDir: "up",
url: "json/GeneralTiposJson.aspx"
, getData: function (dataJSON) {
return { data: dataJSON };
}
}
var newObj = {
flexHeight: true,
flexWidth: true,
dataModel: dataModel,
showTitle: false,
showBottom: true,
toolbar: {
//cls: 'pq-toolbar-export',
items: [{
type: 'button',
label: "Export to Excel",
icon: 'ui-icon-document',
listeners: [{
"click": function (evt) {
$("#grid_export").pqGrid("exportExcel", { url: "json/crud/GrillaCRUDJson.aspx", sheetName: "pqGrid sheet" });
}
}]
}]
},
pageModel: {type:'local'},
colModel: colModel,
selectionModel: { mode: 'single' },
editable: true,
scrollModel: { horizontal: false },
title: "Contact Details"
};
var $grid = $("#grid_export").pqGrid(newObj);
});
This is the json data:
[{"IdRegistro":1,"GlsSiglaCategoria":"Tipo Dato Parametro","GlsValor":"Entero 32 bits"},{"IdRegistro":2,"GlsSiglaCategoria":"Tipo Dato Parametro","GlsValor":"Entero 64 bits"},{"IdRegistro":3,"GlsSiglaCategoria":"Tipo Dato Parametro","GlsValor":"Texto"},{"IdRegistro":4,"GlsSiglaCategoria":"Tipo Dato Parametro","GlsValor":"Decimal"},{"IdRegistro":5,"GlsSiglaCategoria":"Tipo Dato Parametro","GlsValor":"Fecha"},{"IdRegistro":6,"GlsSiglaCategoria":"Tipo Dato Columna Grilla","GlsValor":"Entero 32 bits"},{"IdRegistro":7,"GlsSiglaCategoria":"Tipo Dato Columna Grilla","GlsValor":"Entero 64 bits"},{"IdRegistro":8,"GlsSiglaCategoria":"Tipo Dato Columna Grilla","GlsValor":"Texto"},{"IdRegistro":9,"GlsSiglaCategoria":"Tipo Dato Columna Grilla","GlsValor":"Decimal"},{"IdRegistro":10,"GlsSiglaCategoria":"Tipo Dato Columna Grilla","GlsValor":"Fecha"},{"IdRegistro":11,"GlsSiglaCategoria":"Tipo Permiso","GlsValor":"Menu"},{"IdRegistro":12,"GlsSiglaCategoria":"Tipo Permiso","GlsValor":"Columna de Grilla"},{"IdRegistro":13,"GlsSiglaCategoria":"Tipo Dato Parametro","GlsValor":"Booleano"},{"IdRegistro":14,"GlsSiglaCategoria":"Tipo Dato Columna Grilla","GlsValor":"Booleano"}]
The thing is that the "json/crud/GrillaCRUDJson.aspx" file exists in that path and it just has a reference to Request.Params. I've put a breakpoint in the code behind of that page (GrillaCRUDJson.aspx.cs in the Page_load event) but it doesn't even get called. IDK what could be happening since there's no feedback of the error.
Does the pqGrid("exportExcel"... expect some particular URL? Some obscure GET or POST parameters?.
I hope you can let me a hand on this!
Help is really appreciated.
Thanks in advance!