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

Rows being reordered when sending from client to server

3 Answers 87 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
B
Top achievements
Rank 1
B asked on 01 Oct 2019, 09:30 PM

I just updated the Kendo Spreadsheet components to the latest release and am now having a weird problem when data is posted back to the server, the row order changes.

I have a simple controller method that loads a file and returns data back to the client as a spreadsheet (it's doing some server-side validations but that's irrelevant to the problem).

Then client side I send the data back to the server.  In the past this has worked great.  Now, however, Rows 0 and 1 swap positions.

The only difference between the data coming back with the new component vs. the old is a height attribute.  Aside from that everything else is the same.

Controller Method

public ActionResult LoadFile(HttpPostedFileBase file)
{
    var workbook = Workbook.Load(file.InputStream, Path.GetExtension(file.FileName));
    //workbook = KendoExcelLoader.ProcessWorkbook<MyObject>(workbook, ApplyRules);
    return Content(workbook.ToJson(), MimeTypes.JSON);
}

Client Side (this is where rows 0 and 1 swap positions):

function saveData() {
    kendo.ui.progress($("body"), true);
    var sheetData = $("#spreadsheet").data("kendoSpreadsheet").sheets()[0];
 
    $.ajax({
        type: "POST",
        url: "/import/SaveData",
        data: {records: JSON.stringify(sheetData.toJSON())},
        success: function (data) {
            kendo.ui.progress($("body"), false);
 
        }
    });
}

3 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 03 Oct 2019, 04:10 PM

Hello B Smith,

Thank you for the provided code snippet. 

Unfortunately I was not able to reproduce the issue. In the attached project, if I am importing a file to the Spreadsheet from the controller. Then upon clicking Save as JSON, I am saving the data. If I open it, the data are in the same order as their original state. Am I missing something?

Please try to modify the project to replicate the issue. I will then be happy to assist you.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
B
Top achievements
Rank 1
answered on 04 Oct 2019, 02:14 PM

It looks like it's something specific to the spreadsheet i'm trying to load, but definitely a new issue with the latest release.  I don't want to post the sheet here since it contains data I don't want on the web but if there is a way to send it to you directly I can.  Incidentally, it does seem that the issue is caused by the "height" attribute (see below).  This isn't getting returned from the server when processing with the old version and only breaks the upload in the latest release when that's in the file (but I don't know how it even gets there).

 

{
  "name": "Sheet1",
  "rows": [
    {
      "index": 7,
      "height": 52,
      "cells": [
        {

0
Martin
Telerik team
answered on 08 Oct 2019, 12:02 PM

Hello B Smith,

It really looks something to do with that specific file. In my json file, I tried adding a height field to some of the cells, and the data is still exported and imported in the correct order. I am also getting the height returned wherever I had set it.

As your Support Plan allows unlimited support tickets, I would suggest opening a new support ticket so that you can share the file privately. Rest assured that the information shared within a private thread remains confidential, so you can safely share the file. Simply mention this thread's ID (1432340) so that the ticket would get back to me. I will then be happy to test and assist you.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Spreadsheet
Asked by
B
Top achievements
Rank 1
Answers by
Martin
Telerik team
B
Top achievements
Rank 1
Share this question
or