This is a migrated thread and some comments may be shown as answers.

Spreadsheet Create Method Javascript Runtime Error Missing ';' in Kendo.All.JS

2 Answers 70 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Jignesh
Top achievements
Rank 1
Jignesh asked on 03 Aug 2017, 07:54 AM
Record gets in database with response HTTP 200, but getting error in browser. (PFA attachment)

 

@(Html.Kendo().Spreadsheet()
        .Name("spreadsheet")
        .HtmlAttributes(new { style = "width:100%" })
        .Toolbar(false)
        .Sheetsbar(false)
        .Sheets(sheets =>
        {
            sheets.Add()
                .Name("Exceptions")
                .DataSource<C3Connect.C3i.Models.WFM.ExceptionsSpreadsheetVM>(ds => ds
                    .Ajax()
                    .Batch(true)
                    .Read(read => read.Action("SpreadsheetRead", "Exceptions").Data("spreadsheet_additional_data"))
                    .Update("SpreadsheetUpdate", "Exceptions")
                    .Create("SpreadsheetCreate", "Exceptions")
                    .Destroy("SpreadsheetDelete", "Exceptions")
                    .Events(e => e.Change("spreadsheet_onChange").Error("spreadsheet_error"))
                    .Model(m =>
                    {
                        m.Id(p => p.ExceptionID);
                    })
                )
                .Columns(columns =>
                {
                    columns.Add().Width(100);
                    columns.Add().Width(100);
                    columns.Add().Width(100);
                    columns.Add().Width(100);
                    columns.Add().Width(100);
                    columns.Add().Width(100);
                })
                .Rows(rows =>
                {
                    rows.Add().Height(30).Cells(cells =>
                    {
                        cells.Add()
                            .Bold(true)
                            .Background("#9c27b0")
                            .TextAlign(SpreadsheetTextAlign.Center)
                            .Color("white");
 
                        cells.Add()
                            .Bold(true)
                            .Background("#9c27b0")
                            .TextAlign(SpreadsheetTextAlign.Center)
                            .Color("white");
 
                        cells.Add()
                            .Bold(true)
                            .Background("#9c27b0")
                            .TextAlign(SpreadsheetTextAlign.Center)
                            .Color("white");
 
                        cells.Add()
                            .Bold(true)
                            .Background("#9c27b0")
                            .TextAlign(SpreadsheetTextAlign.Center)
                            .Color("white");
 
                        cells.Add()
                            .Bold(true)
                            .Background("#9c27b0")
                            .TextAlign(SpreadsheetTextAlign.Center)
                            .Color("white")
                            .Format("m/d/yyyy h:mm");
 
                        cells.Add()
                            .Bold(true)
                            .Background("#9c27b0")
                            .TextAlign(SpreadsheetTextAlign.Center)
                            .Color("white")
                            .Format("m/d/yyyy h:mm");
                    });
                });
        })
)

2 Answers, 1 is accepted

Sort by
0
Joana
Telerik team
answered on 04 Aug 2017, 02:25 PM
Hi Jignesh,

I tested a similar configuration of the Kendo Spreadsheet and could not replicate the javascript error. Could you please send us a simple isolated project where we could examine the error? Do you reproduce it without the datasource?

Regards,
Joana
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Jignesh
Top achievements
Rank 1
answered on 14 Aug 2017, 01:05 PM

Hi,

This was resolved by replacing code in Create ActionResult method.

I was using below code,

return Json(new[] { exception }.ToDataSourceResult(request, ModelState));

 

Changed it to below code, returning without array (as described by Telerik Support Team).

return Json(exceptionsVM.ToDataSourceResult(request, ModelState));
Tags
Spreadsheet
Asked by
Jignesh
Top achievements
Rank 1
Answers by
Joana
Telerik team
Jignesh
Top achievements
Rank 1
Share this question
or