Hi this my query from sql server, as you see im trying to add 7 fields and it only shows 6
//////////////// Controler
RepoDapper propRep = new RepoDapper();
var venTerritorio = propRep.ReadPivote();
ViewBag.datasource = venTerritorio;
return View();
///////////////////////////////// Repository
using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["00WEB"].ConnectionString))
{
return db.Query<VTerPivot>("Select top 300 FechaDocumento, DescripcionArticulo, Cantidad, DescripcionCliente, DescripcionGrupoCliente, VentaValor from [00WEB].[dbo].[Territorio]").ToList();
}
//////////////////////////// CSHTML
@(Html.EJ().Spreadsheet<object>("Spreadsheet")
.AllowFormulaBar(false)
.ScrollSettings(scroll =>
{
scroll.Height(560);
})
.ImportSettings(import =>
{
import.ImportMapper("Import");
})
.ExportSettings(export =>
{
export.ExcelUrl("ExcelExport");
export.CsvUrl("CsvExport");
export.PdfUrl("PdfExport");
})
.EnablePivotTable(true)
.Sheets(sheet =>
{
sheet.RangeSettings(range =>
{
range.Datasource((IEnumerable<object>)ViewBag.datasource).Add();
}).Add();
})
.ClientSideEvents(events => events.LoadComplete("loadComplete").OpenFailure("openfailure"))
)
<script type="text/javascript">
function loadComplete(args) {
var xlFormat = this.XLFormat;
this.setWidthToColumns([142, 132, 110, 105, 102, 112, 122, 122, 102]);
//xlFormat.format({ "style": { "font-weight": "bold" } }, "A1:O1"); xlFormat.format({ "type": "shortdate" }, "A2:A5001");
//xlFormat.format({ "type": "currency" }, "G2:G5001");
this.XLRibbon.updateRibbonIcons();
if (!this.isImport) {
var settings = {
rows: [
{
fieldName: "DescripcionArticulo",
}
],
columns: [
{
fieldName: "VentaValor",
},
{
fieldName: "FechaDocumento",
}
],
values: [
{
fieldName: "Cantidad",
}
],
filters: [
{
fieldName: "FechaDocumento",
}
]
};
this.XLPivot.createPivotTable("Sheet1!$A$1:$F$25", null, null, settings);
}
}
function openfailure(args) {
var xlObj = $("#Spreadsheet").data("ejSpreadsheet");
xlObj.alert(args.statusText);
}
</script>
////////////////////////////////////// MODEL
public class VTerPivot
{
public DateTime FechaDocumento { get; set; }
//public int CodigoLaboratorio { get; set; }
//public string DescripcionLaboratorio { get; set; }
//public string CodigoArticulo { get; set; }
public string DescripcionArticulo { get; set; }
public int Cantidad { get; set; }
public decimal VentaValor { get; set; }
//public int CodigoTerritorio { get; set; }
public string DescripcionTerritorio { get; set; }
//public string CodigoCliente { get; set; }
public string DescripcionCliente { get; set; }
//public int CodigoGrupoCliente { get; set; }
public string DescripcionGrupoCliente { get; set; }
}
|
//...
function loadComplete(args) {
//...
if (!this.isImport) {
var settings = {
//...
};
this.XLPivot.createPivotTable("Sheet1!$A$1:$G$25", null, null, settings);
}
}
|