SpreadSheet Fields

Hi, 
Does the spreadsheet have a restriction to add more than 6 fields in the Field List, i also have an error when i try to save it on excel

Uncaught TypeError: n(...).valid is not a function

Regards,



3 Replies

SI Silambarasan I Syncfusion Team October 29, 2017 05:42 PM UTC

Hi Gian Carlo, 
 
Thank you for using Syncfusion products. 
 
We have checked your query and we suspect that you have added more than 6 pivot table fields to generate Pivot table in Spreadsheet. In our end, we have generated the Pivot table with more than 6 fields and export it to excel. Its exported properly without any error and we can’t able to reproduce the reported issue from our end. Could you please provide more information to reproduce the reported issue in our end? 
 
Also, we suspect that the reported issue ‘Uncaught TypeError: n(...).valid is not a function’ and it occur due to unavailability of jquery.validate.min script file in your project. Could you please add the jquery.validate.min.js script reference to your project and get back to us more information if your issue not resolved? 
 
Regards, 
Silambarasan 



GC Gian Carlo October 30, 2017 02:45 PM UTC

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; }

        }





SI Silambarasan I Syncfusion Team November 1, 2017 05:32 AM UTC

Hi Gian Carlo, 
 
Thanks for your update. 
 
We have checked the reported issue with provided information and we found that the cause of added only 6 fields in Field List is due to the range (‘Sheet1!$A$1:$F$25’) defined for creating Pivot table which contains 6 columns only.  So, we suggest you to pass the entire range i.e Sheet1!$A$1:$G$25 to achieve your requirement. Please refer the below modified code example. 
 
 
//... 
 
function loadComplete(args) { 
    //... 
    if (!this.isImport) { 
        var settings = { 
            //... 
        }; 
 
        this.XLPivot.createPivotTable("Sheet1!$A$1:$G$25", null, null, settings); 
    } 
} 
 
 
Screenshot: 
 
 
Also, we have prepared a sample to demonstrate this based on your provided codes and the same can be downloaded from the below sample link. 
 
Could you please check the above sample and get back to us with more information if still the issue persists? 
 
Regards, 
Silambarasan 


Loader.
Up arrow icon