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

Is it possible to delete a row?

3 Answers 86 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
n/a
Top achievements
Rank 1
n/a asked on 24 Sep 2019, 01:35 PM

Hello,

Is there any way to delete a row in the spreadsheet? Currently the deletion(right click and delete button) only empties the row but it does not remove it from the spreadsheet.
Thank you

3 Answers, 1 is accepted

Sort by
0
Aleksandar
Telerik team
answered on 27 Sep 2019, 12:59 PM

Hello,

Thank you for reporting this issue. I tried to replicate the reported behavior locally, but was unable to reproduce it. I'm attaching a screen-cast where a row is deleted from the demo Spreadsheet, available on the Spreadsheet demo page. Along with it you'll also find a sample application implementing the example from the Spreadsheet demo page. Would it be possible to modify the provided demo solution or send a sample project where the reported behavior is isolated, so I can investigate further?

Looking forward to your reply.

Regards,
Aleksandar
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
n/a
Top achievements
Rank 1
answered on 30 Sep 2019, 08:37 AM

Hello, again,

Because i cannot upload a file different from image here on the forums i have uploaded it here: https://filebin.net/aqnceetk0nbecnf9

The changes i made were only that i'm specifying the number of rows i have and removed the merged cells for simplicity.

What i expect when i right click and then select 'Delete' would be to have 4 rows visible left, then 3 and so on, without having any empty rows available to fill with data.

Thank you

0
Aleksandar
Telerik team
answered on 03 Oct 2019, 07:17 AM

Hello,

The desired result can be achieved by binding  custom function to the deleteRow event. Each time you delete a row you can hide a row as the deleteRow method shifts the remaining contents of the sheet up. 

@(Html.Kendo().Spreadsheet()
		.Name("spreadsheet")
        .Events(ev=>ev.DeleteRow("onDeleteRow"))
...


function onDeleteRow(e) {
        var rowCount = e.sheet.toJSON().rows.length;
        setTimeout(function () {
            e.sheet.hideRow(rowCount - 1)
        }, 0);        
    }

Attached you'll find the modified sample project where the above suggestion is implemented.

Regards,
Aleksandar
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
n/a
Top achievements
Rank 1
Answers by
Aleksandar
Telerik team
n/a
Top achievements
Rank 1
Share this question
or